IdentityNow Transforms - Substring

IdentityNow Transforms - Substring

Overview

A substring transform can be used to get the inner portion of a string that is passed into the transform. You can use substring to get the first n characters, or to get a set number of characters within the middle of a string.

Other Considerations

  • The substring transform does not currently provide an easy method to get the last n characters of a string. To achieve this functionality, it is recommended to leverage the Get End of String transform.

 

Transform Structure

The substring transform requires you to provide the beginning location of the input which indicates the start of the desired substring output. It also requires, like all other transforms, the standard type and name attributes:

Example

{
  "attributes": {
    "begin": 4
  },
  "type": "substring",
  "name": "Test Substring Transform"
}

Attributes

  • Required Attributes

    • type - This must always be set to substring

    • name - This is a required attribute for all transforms, and represents the name of the transform as it will appear in the UI's dropdowns

    • begin - This is an integer value for the location within the input data that contains the first character of the substring you want to return.

      • If begin is set to -1, the transform will begin at character 0 of the input data
  • Optional Attributes

    • requiresPeriodicRefresh - A true or false value that indicates whether the transform logic should be re-evaluated every evening as part of the identity refresh process.
    • beginOffset - This integer value is the number of characters to add to the begin attribute when returning a substring. This attribute is only used if begin is not -1.
    • end - This is an integer value for the location within the input data that no longer contains the substring you want to return.

      • If end is -1 or not provided at all, the substring transform will return everything up to the end of the input string.
    • endOffset - This integer value is the number of characters to add to the end attribute when returning a substring. This attribute is only used if end is provided and is not -1.

    • input - This is an optional attribute that can explicitly define the input data which will be fed into the transform logic. If input is not provided, the transform will take its input from the source and attribute combination configured via the UI.

 

Examples

Example 1

Input: "abcdef"

Output: "cd"

{
  "attributes": {
    "begin": 2,
    "end": 4
  },
  "type": "substring",
  "name": "Test Substring Transform"
}

Using a zero-based array, the letter "c" is the begin index of the substring that will be returned, as that is in index location 2. Index location 4 contains the letter "e," so anything between the letters "c" and "e" -- including "c" but excluding "e" -- will be the substring that is returned.

Example 2

Input: "abcdef"

Output: "cde"

{
  "attributes": {
    "begin": 1,
    "end": 3,
    "beginOffset": 1,
    "endOffset": 2
  },
  "type": "substring",
  "name": "Test Substring Transform"
}

Using a zero-based array, the letter "b" is the character in index location 1, but since the beginOffset indicates one additional character must be skipped, the substring transform will start with the letter "c." Index location 3 contains the letter "d," so the transform would normally end at the character just preceding "d." However, with the endOffset value set to 2, an additional two characters will be included, which would be "d" and "e." Thus, the transform returns "cde."

 

References

  • N/A
Comments

Hi Team,

i am trying to get the begin value dynamically, but it didn't work for me ,can anyone help on this

usecase:  To get the OU from DN

i am trying to get "," index after CN and providing that as a input to substring begin value

{
"attributes": {
"input": {
"attributes": {
"name": "dn"
},
"type": "identityAttribute"
},
"begin": {
"attributes": {
"input": {
"attributes": {
"name": "dn"
},
"type": "identityAttribute"
},
"substring": ","
},
"type": "indexOf"
}
},
"type": "substring",
"name": "indexTransform"
}

 

Thanks,

Divya

Version history
Revision #:
3 of 3
Last update:
‎Dec 09, 2021 05:19 PM
Updated by:
 
Contributors