denanife
(Felipe Denani Ventaja)
January 8, 2025, 4:42pm
1
Hi there,
I need to sort a valid ID and split.
I’ve already had this transform to sort:
{
"id": "082d",
"name": "BTG-Sort-AreaIDSAP",
"type": "firstValid",
"attributes": {
"values": [
{
"attributes": {
"sourceName": "Authoritative Source",
"attributeName": "DescArea",
"accountSortAttribute": "Order",
"accountSortDescending": true,
"accountReturnFirstLink": true
},
"type": "accountAttribute"
}
]
},
"internal": false
}
And this to split:
{
"id": "7b7838388",
"name": "BTG-Split-AreaIDSAP",
"type": "split",
"attributes": {
"delimiter": "-",
"index": 0
},
"internal": false
}
Basically, I need to unite both.
sup3rmark
(Mark Corsillo)
January 8, 2025, 4:54pm
2
Which do you want to happen first? The split or the sort?
Also: your firstValid for the sort transform appears to be missing a second value to use if the accountAttribute isn’t populated. Is this intentional?
denanife
(Felipe Denani Ventaja)
January 8, 2025, 4:55pm
3
First I need to sort, then split.
Is this not intentional, if missing can be null.
gourab
(Gourab Sadhukhan)
January 8, 2025, 4:56pm
4
Try this
{
"id": "xxxxxxxxxxxxxxxx",
"name": "Transform",
"type": "split",
"attributes": {
"input": {
"type": "firstValid",
"attributes": {
"ignoreErrors": true,
"values": [
{
"attributes": {
"sourceName": "Authoritative Source",
"attributeName": "DescArea",
"accountSortAttribute": "Order",
"accountSortDescending": true,
"accountReturnFirstLink": true
},
"type": "accountAttribute"
},
"NONE-NONE"
]
}
},
"delimiter": "-",
"index": 0
},
"internal": false
}
Note: Need to be tested
1 Like
sup3rmark
(Mark Corsillo)
January 8, 2025, 4:57pm
5
It looks like the documentation for the split transform primitive is missing its mention of the optional input
attribute, but you should be able to add input
within attributes
(see the example in the transform documentation) and nest your firstValid transform within that.
2 Likes
denanife
(Felipe Denani Ventaja)
January 9, 2025, 7:38pm
6
Thanks everyone,
I tried this and worked:
{
"id": "",
"name": "",
"type": "split",
"attributes": {
"delimiter": "-",
"index": 0,
"throw": true,
"input": {
"attributes": {
"values": [
{
"attributes": {
"name": "departmentad"
},
"type": "identityAttribute"
}
]
},
"type": "firstValid"
}
},
"internal": false
}
If there is any possibility that the attribute ‘departmentad’ could be null, I highly recommend putting in a value into the firstValid to catch this. As Gourab suggested ‘None-None’ would prevent any errors from occurring
1 Like