select the first date and other condition

hello everyone
always thank you for your support!
I would need, to select from an excel file (excel reder) the rows that have the following condition:
-) for each item select the first two shifts of the first day of production
original file

final result

image

thank

Could you post your Excel input file? It makes it easier than having to manually recreate the data from your image.

1 Like

Select First Date.knwf (15.4 KB)

Hello Irivia,

I’m new to Knime and there could be a more efficient way of doing it but please give it a try. I used a table creator to replicate your data. Please make sure you keep the same column naming so the flow works. Just eliminate the last three columns at the end with a node.

select the first

Nice approach @lazaronewhall17 Only remark I would have is that it’s sometimes better to go for inclusion instead of exclusion. In the Row Filter you now exclude a particular range. If for whatever reason the data changes it’s very likely that you will have additional records that pass through the row filter unintentionally because of this. Inclusion is therefore usually a more solid approach. In this case, you can opt to only include 1 and 2 for the Shift.

@lriva An alternative approach is the Group Loop.

Here, the item is the field used to designate the group.

Next, filter for the first two rows in each group by position.

This assumes that the data sorted just like you have in your example. If not, add a Sorter node in between to arrange this. In this particular case, the group loop is also executed quicker due to the join() function in the Column Expression (2 ms vs 54 ms).

image

1 Like

Hi ArjenEX,

That is pretty interesting. Thanks for providing an alternate approach. Contributors like you really help user like me that are starting and encourage us to keep learning. Also, thanks for explaining the inclusion/exclusion approach. Makes total sense. Thanks

1 Like

My first idea was the same as @ArjenEX
then I thought because I don’t like loops using the ranking node and filter based on that should also work.
br

1 Like

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