Using Switch to filter few line items from another table

Hi!! KNIME enthusiastic!!
Hope you are doing well!!

I am facing some issue while developing workflow.

Inputs:
Table -I

Order Material Movement Type Date
2456 a 261 11-08-2020
2456 b 321 12-08-2020
2456 c 101 12-08-2020
2456 d 301 13-08-2020
2456 e ZA1 03-03-2021
2456 f 261 04-03-2021
2456 g 101 05-03-2021
2456 h 301 05-03-2021
2456 i ZA1 05-03-2021
2456 j 301 05-03-2021

Table-II

list need to be included
311
261, 201, 221
301, 302
601
641
643
Z01
701 to 718
551 to 556
651 to 658

Requirement:
Steps-

  1. Arrange dates in ascending order.
  2. Check for movement type 101 in column “Movement type”. and Bring those line items which are matching(given in) with Table-II & coming after movement type 101. Here we need to also consider FIFO method, so need to stop checking before, where again movement type 101 is coming.

So, our output would look like as below:

Material Movement Type Date
d 301 13-08-2020
f 261 04-03-2021

PS: also consider point that sometimes (in certain batches/order of material) movement type 101 will only come one time.

I have tried using switch node but i didn’t get expected result.

Thanks in advance!!

Hi @ravi13,

There are a few questions that I have regarding your problem.

  1. Is the format of table-II as you have presented it, so is it a single column containing values in the form you have shown? If so, then this would require some processing of its own in order that it be put into something that can easily be processed for specific values and ranges.

  2. I note that your first step is to sort the rows into date order, and then you are looking for those movement types that are “coming after movement type 101” and to “stop checking before” the next “movement type 101”, but… do you mean “after” in terms of date or in terms of row-sequence?

  3. In your sample data, movement type 101 is the first row for 05-03-2021, but what if its row position had been switched, when sorting, with material type “h”? Given that they both have the same date, their relative positions after sorting would be arbitrary and there is no guarantee that 101 would appear first. There could be 100 entries for that date before we find movement type 101, for example. So, is the process maybe that you need to find all dates containing movement type 101, and then find all dates "between, (but excluding) the “101 dates” for items derived from Table-II, and then list those items?

  4. Is “movement type 101” just used as an example? Are you only ever interested in movement type 101, or could it be that on another occasion you would be looking for a different movement type?

As you have said that you’ve tried a solution and hit problems using the switch node, I wonder if you have a small sample workflow that you’d be happy to share. We can attempt to find a full solution but maybe if you already have some of the pieces in place, it would be quicker to use what you have and make suggestions on that rather than everybody starting from scratch. I am not convinced that the switch node is the way to tackle this, but the title of your post is “Using Switch…”. Without seeing what you are doing, we cannot tell you what is wrong with what you have done. I’m guessing that actually you are trying to solve your problem using whatever nodes are required, rather than particularly wanting to use the switch node?

Even if you don’t have a workflow, it would be much quicker and easier for us if you were able to upload (as files. e.g. as .xlsx or .txt files) your sample data so that we don’t have to create this ourselves.

1 Like

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