[Solved] Filtration from Array/List

Hi there,

I am curious on whether it is possible to include all values in an array or list and filter out the rest. I only want to include employees in certain countries and would prefer using an array over tons of OR statements.

My data source is a sharepoint list. I have checked the documentation and it mentioned that regular javascript operators are fine but since I don't really know that language I couldn't do much with that information although I believe that I should be using some with indexOf?

Pseudo-code below

var countries = ['a','b','b']
return itemData.Countries is in countries

Hi @Nick_B,
sure! The JS method to check if an element is in an array is the following:

var countries = ["a", "b", "c", "d"];
return countries.includes(itemData.Country);  // returns true or false

Please see more here


1 Like

Dear @v.uspenskii,

Thanks a lot for this, works like a charm and is much easier than I anticipated too!

Really appreciate it