Right Pad
Overview
Use the right pad transform to pad an incoming string with a user-supplied character out to a specific number of characters. This transform is often useful for data normalization situations in which data such as employee IDs are not uniform in length but need to be for downstream systems.
- If the input to the right pad transform is null, the transform returns a null value.
Transform structure
In addition to the standard type and name attributes, the right pad transform requires the length attribute, which tells the transform how many characters to pad the incoming string to.
{
"attributes": {
"padding": "0",
"length": "5"
},
"type": "rightPad",
"name": "Right Pad Transform"
}
Top-level properties (required)
-
type
string(required)
Must be set torightPad. -
name
string(required)
The name of the transform as it will appear in the UI's dropdown menus. -
requiresPeriodicRefresh
boolean(optional)
Whether the transform logic should be reevaluated every evening as part of the identity refresh process. Default isfalse.
Attributes
The right pad transform uses the following structure:
{
"type": "rightPad",
"name": "Transform Name",
"attributes": {
"length": "8",
"padding": "0"
}
}
attributes (required)
The attributes object contains the padding configuration.
Required
- length
string(required)
An integer value for the final output string's desired length.
Optional
- padding
string(optional)
The character to use for padding the incoming data to reach the desired length. Default is a single space" ".
Examples
This transform takes the incoming attribute configured in the Identity Profile attribute UI and ensures it is padded out to 8 characters in length by adding "0"s to the right.
Input: "1234"
Output: "12340000"
Transform request body:
{
"attributes": {
"padding": "0",
"length": "8"
},
"type": "rightPad",
"name": "Right Pad Transform"
}
This example takes the user's employeeID attribute from the HR source and ensures it is padded out to 7 characters in length by adding "x"s to the right.
Input: "1234"
Output: "1234xxx"
Transform request body:
{
"attributes": {
"padding": "x",
"length": "7",
"input": {
"attributes": {
"sourceName": "HR Source",
"attributeName": "employeeID"
},
"type": "accountAttribute"
}
},
"type": "rightPad",
"name": "Right Pad Transform"
}