Forum Discussion

swatifunde's avatar
swatifunde
Contributor
3 years ago
Solved

Filter the data

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

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

    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

3 Replies

  • darshthakkar's avatar
    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:

    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

    • swatifunde's avatar
      swatifunde
      Contributor

      Its working as expected, Thank you so much 🙂

    • alchemiz's avatar
      alchemiz
      Contributor III

      Or you can also use match… e.g.

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