I have a user parameter getting a string of comma separated words. I would like to use that as items/arguments to filter whether or not a feature attribute contain one of those words.
It would be to be used on about 10,000 features eventually with maybe up to 5 different words
I can get the user parameter to a list, and then to an attribute, but I can't find a way to use those to filter my dataset, either using Like, In, or Contains
Any idea how this can be done?
It's basically to filter whether a path does or not contain some words
Best answer by takashi
Hi @ts_84 , I think the "Contain Regex" operator would help you.
StringReplacer: Replace every , (comma) within the parameter value with | (pipe). The resulting string can be interpreted as a regex "word1|word2|word3", which matches one of the words.
FeatureMerger: Merge the regex attribute to every feature read from CSV unconditionally.
Tester or TestFilter: Test if "_full_path" string contains a part that matches the regex, with the "Contain Regex" operator.
The attached screenshot illustrates an example of implementation.
Hi @ts_84 , I think the "Contain Regex" operator would help you.
StringReplacer: Replace every , (comma) within the parameter value with | (pipe). The resulting string can be interpreted as a regex "word1|word2|word3", which matches one of the words.
FeatureMerger: Merge the regex attribute to every feature read from CSV unconditionally.
Tester or TestFilter: Test if "_full_path" string contains a part that matches the regex, with the "Contain Regex" operator.
The attached screenshot illustrates an example of implementation.
Hi @ts_84 , I think the "Contain Regex" operator would help you.
StringReplacer: Replace every , (comma) within the parameter value with | (pipe). The resulting string can be interpreted as a regex "word1|word2|word3", which matches one of the words.
FeatureMerger: Merge the regex attribute to every feature read from CSV unconditionally.
Tester or TestFilter: Test if "_full_path" string contains a part that matches the regex, with the "Contain Regex" operator.
The attached screenshot illustrates an example of implementation.
Thank you @Takashi Iijima , this works perfectly.
It's quite interesting to see Regex can work so simply like that too. And I didn't know a simple '1' would merge feature so easily either. Thanks for your valuable input
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.