Help with an "IF" please

Hi … I have a table similar to the one included below with 2 columns with tracking codes. I need to split the rows and do some additional work depending on some simple IFs

Image 1

  1. IF codeSteet Missing then…
    2 IF codePO Missing then…
  2. ELSE …

I am sure that KNIME can do this with the IF Switch node but I have not been able to get a result (only errors). If anyone could help I would really appreciate some suggestions.

Thanks.
tC/.

Are you sure you need an if switch? Maybe column expressions or rule engine can already give you what you need.
br

4 Likes

Hi @Daniel_Weikert … I tried with a rule engine but there is a slightly different flow and different data to be added depending on which the IF branch.

Hi @TigerCole

It looks like you perform first an action on column codeStreet and after that on column codePO. Maybe split both columns (Column Splitter) do some stuff, and use the Column Appender to bring them together and move on… :thinking:
gr. Hans

3 Likes

Hi @TigerCole , this will depend on what you are trying to do.

An IF Switch is more of a router that will route your workflow. So if you have different routes that contain multiple chained processes, that’s where you want to use an IF Switch.

If you just need to generate some values based on some conditions, that’s where you can use the Rule Engine or Column Expressions.

While you gave the following to us:
IF codeSteet Missing then…
IF codePO Missing then…
ELSE …

without knowing what you want to do after the “then” and “ELSE”, it’s hard to advise what to do.

We also need to know what the expected results should be once these 3 cases are processed in order to connect them with an END IF (or a CASE SWITCH End if we use CASE instead of IF given that you may have more than 2 conditions)

5 Likes

Hey @TigerCole – If the Rule Engine works, other than splitting the dataset so that some rows can go to one part of the workflow, and the rest of the rows to the other part of the workflow, try the “Rule-based Row Splitter” node.

I think this will solve your problem. This node allows you to create criteria that allows you to split your dataset into two separate paths depending on if they meet the rule or not.

Hope this helps!

2 Likes

Hi @bruno29a … the case was actually quite simple and I managed to solve it by splitting out the rows with a strCode and then doing the same to split out rows with a boxCode. I was left with the rows that had neither. I then processed each subset and did a join at the end to bring them all back together again at the end.

I am sure that this project is going to require an IF switch soon but I will post a new topic with a more complete explanation that includes all the points you included in your response now that I understand the IF node purpose better.

Thanks

tC/.

2 Likes

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