Hi,
Sometimes ‘DEPT_NAME’ is having less characters than ‘end’ index 64. In that case it returns ‘null’ value. How to handle this substring that it should return all characters from attribute if less than 64?
"deptname": {
"attributes": {
"values": [
{
"attributes": {
"begin": 0,
"end": 64,
"attributes": {
"attributeName": "DEPT_NAME",
"sourceName": "Oracle ERP"
},
"type": "accountAttribute"
},
"type": "substring"
},
{
"attributes": {
"value": "N/A"
},
"type": "static"
}
]
},
"type": "firstValid"
},
1 Like
You can use a combination of transforms to form a pipeline of operations that will get you what you want. The order of these operations should be:
right pad transform → substring transform → trim transform
The right pad transform will add white-space to the end of DEPT_NAME
. This will prevent your substring transform from returning null, since all strings will now have at least 64 characters. Finally, you use the trim operation to trim off the whitespace from your padded DEPT_NAMES
.
Something like this?
"deptname": {
"attributes": {
"padding": "0",
"length": "64",
"input": {
"attributes": {
"begin": 0,
"end": 64,
"input": {
"attributes": {
"input": {
"attributes": {
"attributeName": "DEPT_NAME",
"sourceName": "Oracle ERP"
},
"type": "accountAttribute"
}
},
"type": "trim"
}
},
"type": "substring"
},
"type": "rightPad"
}
}
1 Like
Transform logic is evaluated inside, out, so you will want right pad to be the innermost JSON, then substring, then trim. Also, we’ll not specify a padding character for rightPad so it uses the default single space so our trim transform will work. Something like this:
"deptname": {
"attributes": {
"input": {
"attributes": {
"begin": 0,
"end": 64,
"input": {
"length": "64",
"attributes": {
"input": {
"attributes": {
"attributeName": "DEPT_NAME",
"sourceName": "Oracle ERP"
},
"type": "accountAttribute"
}
},
"type": "rightPad"
}
},
"type": "substring"
},
"type": "trim"
}
}
2 Likes
Hi @colin_mckibben seems like with above syntaxes $deptname
returning attribute object as {attributes=com.sailpoint.seaspray.transform.TrimTransform@59626e33}
and not the exact value.
do we need to explicitly retrieve the value from this attribute object?
I’m using it as below
"value": "#if($dept!='N/A' || $deptname !='N/A')$dept - $deptname#end"
1 Like
Apologies. I didn’t test the transform that I gave you, and they are tricky to get right. Here is the correct transform syntax, which I tested on my end and validated that it performs the logic you are trying to achieve.
"deptname": {
"type": "trim",
"attributes": {
"input": {
"attributes": {
"begin": 0,
"end": 64,
"input": {
"attributes": {
"length": "64",
"input": {
"attributes": {
"attributeName": "DEPT_NAME",
"sourceName": "Oracle ERP"
},
"type": "accountAttribute"
}
},
"type": "rightPad"
}
},
"type": "substring"
}
}
}
2 Likes
Thank you so much @colin_mckibben
1 Like