Hello I am still very new to KNIME and I have a problem.
So I have this table as input,
I want to have a rule where if there’s 0 in any of the columns for each row, I will include the row. If there’s no 0 at all like in row 6 then remove it. So the resultant table should only have rows 1,3,4,5.
How do I acheive this outcome without hardcoding (meaning without referencing any of the column names)? Thanks for all the help!
My suggest is to unpivot your data; once in a single column it is easy to match == 0 TRUE / FALSE with String Manipulation if ‘string’ as in your example, or Math formula if ‘numeric’. Then you will have to ‘Pivot’ back the LOGICS and join to the original table.
The following step is with a Column Aggregator for your LOGICS by using Concatenate as Aggregation Setting. And finally a new ‘String Manipulation’ node to match the TRUE content in the concatenated column of LOGICS. The resulting TRUE / FALSE column will be your Filter Column.
Followed by a Nominal Value Row Filter to filter out the rows with a 0 by using a (.*\D[0].*)|([0].*) Regex (which translates to contains a zero or starts with a zero) which filters rows 1,3,4 and 5 like you mention.
This is a great solution! However, my values are not integers. Meaning to say that some of my values are 10.04 and rows that have no 0 but contains these decimal places seem to get included as well. Do you perhaps have any workaround for this?
Thanks a ton!
Since I am using “Enforce exclusion” and not excluding anything, it will automatically include all the columns (so no need to hardcode any column names).
I’m also selecting the option of not storing duplicate values since it only take 1 “0” from any column for the row to be included (the search will be faster).
This is what we get as generated collection (set):
Then we just need to filter on the collection that has “0” in it: