is it possible to create a list for example:
sweets = cake, ice cream, cupcake, candy.
soups = tomato, pea, fish
And then configure the filter for example:
the text does not contain words from sweets and soups.
So that I can easily use these sheets in different parts of the circuit, I do not change everything in different actions.
Thanks.
Found way with Tools - Set multiple variables, but is it best way?
Hi
It may not be easy to do in a single filter and it very much depends on the exact scenario idea and data you work with.
But in case you would simply compare simple text (string) to all words in two predefined strings, you could use the below formulas with a lot(!) of functions.
Let’s say you have two strings with “keywords” and one “text”.
What the upper part of filter conditions does is that it splits the “text” word by word into a simple array and adds it to an array with “soups” keywords (also split from the string). All with “split”, “add”, and “flatten” functions.
e.g. as in the below picture
You can see the array now contains 2 “fish”. One from the “text” second from “soups”.
It then gets deduplicated (function “duplicate”) which effectively deletes one of the “fish”.
Finally, the function “length” returns the number of items in the array.
A similar is done in the bottom part of conditions but the joined array is not deduplicated.
So what the filter does is it checks whether the array of all deduplicated has the same length (number of items) as the array of all without deduplication.
If there was a word in “text” that was included in the “soups” or “sweets” lengths wouldn’t be the same and the filter would stop the flow.
In case there wasn’t (lengths would be the same) filter passes the data further into the flow.
The above should work for the text of any length.
In order to make it “bulletproof”, you might want to add extra “replace” and “lower” functions to replace all possible (. ; ! ? - etc) characters with “space” so the text is lowercased and no special character will break the formulas.
Also, you can find more info on functions in this help doc.
Cheerio
2 Likes