07-16-2023 07:38 AM
Hello Team,
I have the below array and I need to fetch the filename where active=1. Please can you help me on this.
“array” : [
{
“active”: 0,
“fileName”: “test.pdf”
},
{
“active”: 1,
“fileName”: “test1.pdf”
}
]
Thanks in advance!
07-16-2023 11:32 AM
Hi @Manigandan ,
You can use the Filter snap to filter out only active objects.
Please take a look at the attached pipeline.
00_Fetch_Active_2023_07_16.slp (4.6 KB)
Best regards,
Marjan
07-18-2023 01:10 AM
Hi @Manigandan,
@marjan.karafiloski’s solution will help you in this case.
If you want to keep everything in one mapper, then take a look at the array filter function:
The expression would look something like this:
$array.filter(x=>x.active == 1)
Regards,
Bojan