darshthakkar
4 years agoValued Contributor
Using list of values in Filter snap
 Hi Team, 
 Is it possible to function a list of values in the  filter  snap?  
Let’s assume, I want to filter IDs whose values are 100, 110, 300, etc., how can I put this in Filter snap without using...
- 4 years agoIt depends. If your $ID are numbers, you can change the expression to [100, 110, 300].indexOf($ID) != -1I don’t understand your last question about Mapper. Since you mentioned using the Filter snap, this is for the Filter expression setting. 
- 2 years agoI used the dummy data below to create a working solution. 
 Input:[ {"txt":"abc"}, {"txt":"efg"}, {"txt":"c - abc"}, {"txt":"c - xyz"} ]In the pipeline properties, I've defined a parameter filterValues that will contain the strings based on which you want to filter the records.Use the below expression in the filter snap:JSON.parse(_filterValues).map(x => $txt.contains(x)).filter(y => y == true).length == 1The result based on the input above looks like this:The record that doesn't have the matching string defined in the filterValues parameter will be omitted.Hope this helps!Cheers😉,
 Abhishek
- 2 years agodarshthakkar - My solution is pretty similar to what Abhishek_Soni37 provided. I would recommend that you not use JSON.parse() for every record. It can be fairly taxing on your CPU depending on data volume. If you want to remove the hardcoded reference to the array of values to search for, I recommend you look at Expression Libraries. Hope this helps!