11-16-2023 07:12 AM
to filter out column A if it is null but not other columns
[
{
"Record" : [
{
"Customfields": {
"A" : "",
"B" : "defg"
},
"Name" : "khu"
}
]
}
]
11-20-2023 04:43 AM
@KTsnap - I'll solve this with the help of one of my favorite features in SnapLogic: the Mapping root.
Configure a Mapper snap as follows:
The "Mapping root" is widely overlooked but immensely powerful. It allows you to take action on a subsection of hte input document. In this case, I want to work only on the objects within the Record array. By specifying $Record[*] in the mapping root, I can access those objects as if they were the input documents... I don't need to loop through that array myself.
In the Mapping table Expression, I'm using an Object.filter() method to remove the fields based on a condition - in this case, I only want to keep fields that have some type of value. In your post, you stated non-null, but show an empty string, which are different in JSON. So I checked for any value greater than an empty string, which will filter both nulls and empty strings.
Hope this helps!