Fitering for rows between two strings

Hi, Is there a way to filter for two different strings and the rows in-between

First, filter for string1 and make sure that it is found that is true (I know that if found that the Row ID for string1 will be a lower number, towards the top of the list),

and then filter for string2 (the row ID for string2 will be a bigger number, towards the bottom of the list;

And assuming that both are found, return all rows in between and inclusive of rows in which strings 1 and 2 are found?

I realize that this might require more than one node but being new to Knime I can’t be sure?

Thank you so much,
Steve

Hi @Selster
I’m not sure this is your question, but if you have two row IDs and want to filter rows between these two IDs, you can do this with the “Row Filter” node. For example here i filtered rows whose ID is between 50 and 127:
image
FilterWithRowID.knwf (941.0 KB)

3 Likes

I know that I can filter between rows, as you point out above.

Now imagine that you have asked number of rows that say 57. And that you know that you have a string that say Barbara one that usually occurs somewhere in strings two through five. Let’s call that string1.

And that you know you have another string, let’s call it Robert, that usually occurs someplace in rows 21 through 36. Let’s call that string2.

And let’s say that you have 251 Excel spreadsheets in a certain file folder. And so you open the first of these Excel files.

And you look for a row that has Barbara in it, knowing that no other roads will have this character string. And you find it in row number nine. So you store row number 9 to a variable. Let’s call this variable1.

And then you look around, knowing that Robert will only occur once in the table and you find it in row number 27. So you store this row number ID to variable2.

And then you go back as you did above, and you filter for rows nine through 27, inclusive of all the rows in between, and encloses of row nine and wrote 27. And you don’t use the actual numbers nine or 27. Instead you filter using the variables, variable1 and variable2. So you really saying, show me all of the rows that are in between variable1 and variable2, including the row for variable1 and variable2.

Can this be done, without going to SQLite inside of knime? Or if one were to use SQLite, would it be much slower than using native knime row filters, for instance

I hope this explains better what my question is?

Thank you so much
Steve

Hi @Selster,

maybe this example gives you an idea how it could be solved.

Example

BR

Example.knwf (36.0 KB)

2 Likes

Very impressive. Thank you so much!
Steve

Hi @Selster,

How about using this component I built for you:

Also available at KNIME Hub:

You have options in the component’s configurations to input starting and ending terms, the string column you want to check and also make filter inclusive or exclusive.

:blush:

2 Likes

Can I download it, if so, how?
Thanks,
Steve

Sorry, there’s a button in the node pit for downloading.

I can’t figure out how to seed your workflow? Is it supposed to be self-seeding or can I start it with an excel file?

Steve

I also can’t figure out how t create an input stream from an excel spreadsheet reader?
Thank you.
Steve

You can import the component into KNIME and then drag and drop it into your workflow. Or just drag and drop it from KNIME Hub into your workflow.

To read multiple Excel files read this post:

:blush:

1 Like

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