Filter depending on Value

Hello,
ich have a huge table and i want to filter it.
I have one Column called Filter_Status. This column contains weither the value: FilterEnd, FilterBegin or some random negativ number.
Now i want to filter out all rows between FilterBegin and FilterEnd. But not the rows between FilterEnd and FilterBegin. Its also possible that multiple FilterBegins are in between to. The start Value who has FilterBegin should be excluded through the filter. The last row with the status FilterEnd shoul still be part of the table.

How can i create such a filter.

Hi Lukas and welcome to the Forum,

I think what you want to achieve should be doable with KNIME although it will require some additional “data wrangling” I think.

In order to best help you, can you provide a simplified example that shows a simplified, (anonymsed) example of your data and then an example of the desired output? You can do that in Excel or even create a workflow for that already.

Based on that I’m sure either myself or someone else here will find the time to guide you or even provide a prototype.

Here is a simple Example.
I hope this is better for explanation.

Can you upload the Excel file please? Either just drag and drop it into the text field you are typing in or use that button:
image
I’ll start thinking about it :slight_smile:

/Edit:

Using some fake data I came up with this prototype:

SpecialFilterSolution.knwf (83.7 KB)

Overview:

If I understood correctly, the simple rule is to include rows that:

  1. have FilterEnd in them
  2. that have “FilterEnd” in a previous row

So I created a new column that only has FilterEnd/FilterBegin in it - or a missing value. Using Missing Value Node we can set any missing value to the last “none-missing” value in a previous row.

After that we filter that new column for “FilterEnd”.

Example.xlsx (10.6 KB)

here is the Excel Example

Yes you’re example you sent works the right way

1 Problem. Because i’m working for a company i cant install the newest version of KNIME in which you created your example so i cant load and look at your example solution.

What version are you on?

I think only node that won’t work is Expressions as it was only introduced with 5.3.

The Verision im using ist 4.7.5

Uff - OK… I have replaced:

  1. Expressions with Rule Engine
  2. Row Filter (new UI) with Row Filter (deprecated)

I think that should hopefully be backwards compatible…

Here is the updated file:
SpecialFilterSolution.knwf (83.7 KB)

If that doesn’t work then:

  1. use this in Rule Engine Node to Create a new Column “Case”:
$FilterStatus$ = "FilterBegin" => "FilterBegin"
$FilterStatus$ = "FilterEnd" => "FilterEnd"
  1. Configure Missing Value Node like this:

  2. then add Row Filter to Filter column “Case” for “FilterEnd”.

If that all works out I#d appreciate for you hitting the Solution Button :slight_smile:

1 Like

It worked.
Thank you for you’re help :grinning: :+1:

1 Like

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