cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Filter the data

swatifunde
Contributor

Hello Community,

Below is input
[
{
โ€œnameโ€=โ€œABCโ€
โ€œIDโ€=โ€œD.0012โ€
},
{
โ€œnameโ€=โ€œXYZโ€
โ€œIDโ€=โ€œB.002โ€
},
{
โ€œnameโ€=โ€œOPQโ€
โ€œIDโ€=โ€œE.0012โ€
},
{
โ€œnameโ€=โ€œLMNโ€
โ€œIDโ€=โ€œJ.0012โ€
},
{
โ€œnameโ€=โ€œDEFโ€
โ€œIDโ€=โ€œC.0012โ€
},
{
โ€œnameโ€=โ€œRSTโ€
โ€œIDโ€=โ€œB.05โ€
}
]

I have millions of records like this , I want to filter them based upon one key named as โ€œIDโ€: and need the data for only the object which have โ€œJ.โ€ or โ€œC.โ€ and discard all the rest ID

1 ACCEPTED SOLUTION

darshthakkar
Valued Contributor

@swatifunde - The simplest approach is to use a filter snap and put a condition of startsWith either J or C. Snap below:

image

Would the ID be always in the format of โ€œLetter.(number)(number)(number)(number)โ€?
If yes, you can use the above-mentioned approach. Also, if youโ€™re expecting ID to be Null/blank and want them to pass, please do select โ€œNull-safe accessโ€.

Regards,
Darsh

View solution in original post

3 REPLIES 3

darshthakkar
Valued Contributor

@swatifunde - The simplest approach is to use a filter snap and put a condition of startsWith either J or C. Snap below:

image

Would the ID be always in the format of โ€œLetter.(number)(number)(number)(number)โ€?
If yes, you can use the above-mentioned approach. Also, if youโ€™re expecting ID to be Null/blank and want them to pass, please do select โ€œNull-safe accessโ€.

Regards,
Darsh

Or you can also use matchโ€ฆ e.g.

sl.ensureArray($ID.match(/J|C/g)).length > 0

Its working as expected, Thank you so much ๐Ÿ™‚