Row filters based on a value: I want to know if a there are no rows matching the criteria

I’m relatively new to Knime and struggling with filtering. I have a column titled “full-fam-num” with each row containing the same string. I have a column titled “cited-phase” that I want to use to filter. There are several possible values but I want to retain rows only if the value is “search”. Sometimes there are no rows with the correct “cited-phase” value and I still want to retain the “full-fam-num” for use later in the workflow.

@anlanious welcome to the KNIME forum. You could preserve the value as a flow variable. Selecting one row and transfering that to a flow variable.

If you want to continue after an empty selection you might have to plan for that.

https://medium.com/low-code-for-advanced-data-science/knime-cases-switches-and-catching-errors-5ab748cbeaa3

2 Likes

Hi @anlanious

Maybe instead of filtering, spiting will be a right option for you. Instead of using ‘Row Filter’ you coud use ‘Row Splitter’ and then you could do:

  • Sequence of operations on rows meeting criteria used for splitting
  • Another sequence of operations on other rows

Finally, you could match both subsets of data with ‘Concantenate’ node.

Happy KNIMEing!

2 Likes

Thank you for your response. I’m still struggling with handling when all rows are sorted into the same table, i.e., are removed because they do not meet the criteria. I basically need to report if the no rows meet the criteria based on the “full-fam-num” column. Any additional guidance?

I’m not sure what the expected result is. Could you please show/share your case (without revealing any confidential details)?

2 Likes

I’m sorry I am having a difficult time describing my problem. This is a patent number in the full-fam column. Some times there can be different numbers, but there is only a single number for this example. I use this full-fam column to retrieve information from an endpoint. The information is in a column titled “text” and a column titled “cited-phase”. There are several possible values for the cited phase. I want to filter out all rows where the cited phase is NOT simply “search”. However, if as in this example, no rows have “search” in the “cited-phase” column I still want to retain the full-fam column and have a new column of “not available” or something. I need to still report the full-fam number and the null result.

Is that more clear?

@anlanious why not use the Row split node. Fill the path with just the “search” with an expression that converts this into “not available” and then concatenate it together.

Or there is more to it than we currently understand.

2 Likes

Just to be precise: “Row Splitter” should use “*search*” string as criterion.

1 Like

Thank you mlauber71. This method worked well! Much appreicated

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.