rmccoy-unum
(Robert McCoy)
November 20, 2024, 10:07pm
1
I’ve hit a wall with a transform. I tried using a conditional, but wasn’t getting anywhere - so I switched to a firstValid.
In short, I need the transform to return a blank value if both account attribute values are blank.
If either of them has data in it, I need that data returned (after being washed for ISO8601).
If both of them have data, I need the HR ORG SOURCE value to be returned.
Oh yeah, bad news, both are dates in slightly different formats which require some pretreatment to get them into ISO8601 - and the treatment isn’t the same.
Maybe there’s a whole other way.
{
"name": "New Term Date",
"type": "firstValid",
"attributes": {
"values": [
{
"attributes": {
"firstDate": {
"attributes": {
"input": {
"attributes": {
"sourceName": "Workday HR",
"attributeName": "LAST_DAY_OF_WORK"
},
"type": "accountAttribute"
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
}
}
},
{
"type": "dateFormat",
"attributes": {
"input": {
"attributes": {
"input": {
"attributes": {
"input": {
"attributes": {
"sourceName": "JDBC HR ORG",
"attributeName": "D_TMN"
},
"type": "accountAttribute"
},
"regex": "(?=\\s).*",
"replacement": ""
},
"type": "replace"
}
},
"type": "trim"
},
"inputFormat": "M/d/yyyy",
"outputFormat": "ISO8601"
}
}
],
"ignoreErrors": true
},
"internal": false
}
Hi @rmccoy-unum ,
Here’s the updated transform,
{
"name": "New Term Date",
"type": "firstValid",
"attributes": {
"values": [
{
"attributes": {
"attributes": {
"input": {
"attributes": {
"sourceName": "Workday HR",
"attributeName": "LAST_DAY_OF_WORK"
},
"type": "accountAttribute"
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
}
},
{
"type": "dateFormat",
"attributes": {
"input": {
"attributes": {
"input": {
"attributes": {
"input": {
"attributes": {
"sourceName": "JDBC HR ORG",
"attributeName": "D_TMN"
},
"type": "accountAttribute"
},
"regex": "(?=\s).*",
"replacement": ""
},
"type": "replace"
}
},
"type": "trim"
},
"inputFormat": "M/d/yyyy",
"outputFormat": "ISO8601"
}
},
null
],
"ignoreErrors": true
},
"internal": false
}
I actually don’t understand your "regex": "(?=\s).*",
. Could you please confirm that before you add this transform.
Hope this helps!
If you want the "sourceName": "JDBC HR ORG",
as the priority, just move this part of the transform above "sourceName": "Workday HR",
You can use this discussion as a reference - Transform to return NULL
suresh4iam
(Suresh Kumar Palanisamy)
November 20, 2024, 10:39pm
4
Robert McCoy:
(?=\s).*
Looking at your transform, you may need to change the order in the first valid on your existing sources and also add the blank value at the end of firstValid with empty double quotes.
In firstValid transform,
First value should be calculated from HR ORG SOURCE, I believe it is JDBC HR ORG in your transform
Second Value should be from the source Workday HR
Third value, is a static transform with “”. You can test this value by adding some default values instead of empty quotes like “none”
{
"name": "New Term Date",
"type": "firstValid",
"attributes": {
"values": [
{
"type": "dateFormat",
"attributes": {
"input": {
"attributes": {
"input": {
"attributes": {
"input": {
"attributes": {
"sourceName": "JDBC HR ORG",
"attributeName": "D_TMN"
},
"type": "accountAttribute"
},
"regex": "(?=\\s).*",
"replacement": ""
},
"type": "replace"
}
},
"type": "trim"
},
"inputFormat": "M/d/yyyy",
"outputFormat": "ISO8601"
}
},
{
"attributes": {
"firstDate": {
"attributes": {
"input": {
"attributes": {
"sourceName": "Workday HR",
"attributeName": "LAST_DAY_OF_WORK"
},
"type": "accountAttribute"
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
},
"type": "dateFormat"
}
}
},
""
],
"ignoreErrors": true
},
"internal": false
}
vbdm
(Veera bhamidipati)
November 20, 2024, 10:41pm
5
Robert McCoy:
HR ORG SOURCE
I Have not tested it but may be you can do something like this:
{
"id": "",
"name": "",
"type": "static",
"attributes": {
"firstAttributeValue": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "HR",
"attributeName": "firstAttribute"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": "firstValue"
},
"type": "static",
"name": "Static Transform"
}
]
},
"type": "firstValid",
"name": "firstValid2"
},
"secondAttributeValue": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "HR",
"attributeName": "secondAttribute"
},
"type": "accountAttribute"
},
{
"attributes": {
"value": "secondValue"
},
"type": "static",
"name": "Static Transform2"
}
]
},
"type": "firstValid",
"name": "firstValid1"
},
"HRORGSOURCE": {
"attributes": {
"sourceName": "HR",
"attributeName": "Org_Source"
},
"type": "accountAttribute"
},
"value": "#if($firstAttributeValue=='firstValue' && $secondAttributeValue=='secondValue')''#elseif($firstAttributeValue=='firstValue' && $secondAttributeValue!='secondValue')$firstAttributeValue#elseif($firstAttributeValue!='firstValue' && $secondAttributeValue=='secondValue')$secondAttributeValue#elseif($firstAttributeValue!='firstValue' && $secondAttributeValue!='secondValue')$HRORGSOURCE##end"
},
"internal": false
}
Hi @rmccoy-unum ,
Did any of these work for you? If yes, please mark that post as the solution
We got it sorted with the following.
{
"id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"name": "New Term Date",
"type": "firstValid",
"attributes": {
"values": [
{
"type": "dateFormat",
"attributes": {
"input": {
"attributes": {
"sourceName": "Workday HR",
"attributeName": "LAST_DAY_OF_WORK"
},
"type": "accountAttribute"
},
"inputFormat": "MM/dd/yyyy",
"outputFormat": "ISO8601"
}
},
{
"type": "dateFormat",
"attributes": {
"input": {
"attributes": {
"input": {
"attributes": {
"input": {
"attributes": {
"sourceName": "JDBC HR ORG",
"attributeName": "D_TMN"
},
"type": "accountAttribute"
},
"regex": "(?=\\s).*",
"replacement": ""
},
"type": "replace"
}
},
"type": "trim"
},
"inputFormat": "M/d/yyyy",
"outputFormat": "ISO8601"
}
}
],
"ignoreErrors": true
},
"internal": false
}
1 Like
system
(system)
Closed
February 17, 2025, 6:59pm
8
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.