Hello Jarmo,
Thanks the Filter each () seems to do the trick, even with more intricate inputs (see below).
Ideally I need the options to filter ChosenDataCol with the 2 ways:
- Remove unwanted elements based on list of string (this method here, which works now) => RemoveCol
- Only keep elements based on list of string (the opposite of the method here)
I thought removing the "NOT" from "!Contains()" should do the trick but it returns an empty list { }.
Do you know why?
thanks
Remove elements <-- works well
Names Default To Here(1);
ChosenDataCol = {"SiCal 1", "Ba Cal 2", "toCal 3", "Si Temp1", "bouTemp25", "CaBlue 56", "SiBlue 32", "Blue 95"};
RemoveCol = {"Cal", "Blue"};
vals = Filter Each({val1}, ChosenDataCol,
res = Filter Each({val2}, RemoveCol,
!Contains(val1, val2)
);
N Items(res) == N Items(RemoveCol);
);
// log : {"Si Temp1", "bouTemp25"}
Keep elements <-- doesn't work
Names Default To Here(1);
ChosenDataCol = {"SiCal 1", "Ba Cal 2", "toCal 3", "Si Temp1", "bouTemp25", "CaBlue 56", "SiBlue 32", "Blue 95"};
KeepCol = {"Cal", "Blue"};
vals = Filter Each({val1}, ChosenDataCol,
res = Filter Each({val2}, KeepCol,
Contains(val1, val2)
);
N Items(res) == N Items(KeepCol);
);
// log : {}