Removing a row if contains a value within a list

I’ve used the Groupby node to aggregate all the different types of transport in a city all into a column containing 1 list.

Now I’m hoping to remove any rows that have the value “Car” in the list. I’ve been trying to do this through Rule-Based row filter, but with no luck so far.

Would appreciate any help!

@nightsky3

Welcome to the world of KNIME.

The first idea coming to my mind:
Delete “Car” from the second list and make a join with your first list.

1 Like

Hi @nightsky3, and welcome to the forum!

As @knimediger has said, you could find a way of filtering the list first, but you would need to find all cities for which a vehicle type is car, and then do an “anti-join” using that list of cities to remove all rows for cities where at least one row is “Car”.


But actually, you can also just use a Row filter either using Regex

or by specifying “based on collection elements”:

The attached workflow gives an example of all the above mechanisms. There will be other ways to achieve this result I’m sure.

image
image
Filter aggregations.knwf (17.0 KB)

5 Likes

I’d have used “Unique concatenate” in the GroupBy and then a Row Filter, but that’s because I didn’t know that the filter works on lists. Now I know what that checkbox is for! :slight_smile:

2 Likes

@nightsky3, @takbb, @knimediger, @Thyme
I figured out one more solution with Groupby, Ungroup and Reference Row Filter nodes:

Please find attached the workflow!

Best Regards,
Roland

Filter_out_cities(cars).knar.knwf (24.6 KB)

3 Likes

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