Conditional Filter

#1

Hi I come from an Alteryx background so I am unsure how to do the following:

How do I make a custom filter with multiple conditions. For example I want to filter my data based on a site id that starts with “00” or is greater then “510001234”. Is there a tool where I could type this formula. I have been looking at rule based row filter, but it doesn’t seem I can filter by “starts with”.

0 Likes

#2

Welcome to KNIME forum.
Starts with corresponds to like “aaaa*”

1 Like

#3

Hi there @Auzzie99,

welcome to Community!

You are right. Rule-based Row Filter node is one for filtering based on one or more conditions but not sure you can use it in this case. Your column has leading zeroes so I guess it is string type and greater operator won’t give you right results on string column. On the other side if you convert it to number then you will lose leading zeroes. To overcome this I would use Column Expressions node which uses JavaScript syntax and automatically converts string to number when using greater operator. This line should do the trick:

column("column1") > 10 || column("column1").startsWith("00")

This will return Boolean true or false value in new column and then use Row Filter or Nominal Value Row Filter or above mentioned Rule-based Row Filter node to have wanted rows.

Considering you are coming from Alteryx check this topic:

In it, among other things that can help, you will find link to new book From KNIME to Alteryx :wink:

Happy KNIMEing!

Br,
Ivan

1 Like