akarsh
2 years agoNew Contributor III
Filter Single attribute from JSON list to use it in a like query
My Input looks like this.
{
"totalCount": 4,
"dataList": [
{
"IfaNumber": "1",
"alink": "",
"agroupId": ""
},
{
"IfaNumber": "2",
"alink": "",
"agroupId": ""
},
{
"IfaNumber": "3",
"alink": "",
"agroupId": ""
},
{
"IfaNumber": "1",
"alink": "",
"agroupId": ""
}
]
}
Can anyone help me to get all the unique IfaNumber from the json list in mapper and form the output in form of ["1","2",3"]
So that I can pass it in Salesforce Lookup snap to get all the account Id for respective IfaNumber.
Hello akarsh,
You can try with the following expression in a Mapper Snap:
$dataList.map(x => x.IfaNumber).filter((x,ind,arr) => arr.indexOf(x) == ind)
This expression, first maps only the IfaNumber values from the dataList array, then filters out the duplicates.
Attaching the sample pipeline below.
Let me know if this helps you!
Regards,
Aleksandar.