Case Switch and Loop issues

Hi all,
I working on a complex workflow and have just started using Case Switch - in the section of the workflow I am referencing here I have 4 different cases (each feeding to a separate metanode with different processing requirements).

Using the Case Switch, I am trying to determine which metanode (e.g. A, B, C or D) is the correct one to go to based on the PortIndex variable.

Note - this section of the workflow is part of a much larger Workflow (a huge loop) that I am working on. Only 1 metanode will ever be run on each pass-through.

Essentially, what I need to achieve is that in each metanode a sheet is appended to an excel file (if in active path) then, once that is completed, jump out to the outer loop to run another pass for a different task (i am still working on this outer loop but need to get the inner loop sorted first).

I am hoping to get some advice advice on the following please:

a) how do I end the case switches (I’ve tried end if too) when they are stacked in the manner that you can see in the screenshot?
b) I can’t for the life of me figure out how to close this loop when I have 3 separate variable streams (i think) plus I don’t actually need the data to be output from each metanode (as I hope to write to excel within each node (when active).

Thank you in advance for any assistance you can provide.

TP

Hello @taylorpeter55
I’ve spend a couple of minutes trying to replicate your workflow (as an illustrative composition) so we can follow the idea and try to make it work.

I am only concentrating on the inner process that should run inside the loop (not in image), so, take a look at this image, does this works for you ? Like the if and end-if pair, you also have the switch-start and switch-end pair.

We have a cascade composed by two pairs of start-end switches. The first two ports of the first switch will enable either the Metanode A or B, those are straightforward, then the third port, will enable the “inner” switch, that in turn have again two options, Metanodes C and D, that are selected based on the second rule engine calculation. And here I think are the missing pieces of your implementation, the switch end, in the inner switch, that node will collect either output from before, C or D, an the second one, will collect the A, B or C-D outputs. Finally will write any of those outputs to the Excel (remember to configure the excel write to append sheets).

After analyzing the workflow, in my perspective I think that we can further improve this by getting rid of the inner switch case, and working the four port choices in the first rule engine (top left green annotation). So, again take a look at this configuration:

This is possible because if you see, you will only enable one Metanode at a time, and in each iteration, you should decide which one, technically there is no need of the inner switch case. Does this make sense to you ?

Note: I am showing you also two ways of closing this inner loop, I am not sure what are you going to do with the output of each iteration.

Take your time and analyze this and tell me if you need some clarifications.

Cheers,
Emiliano.

Hi, apologies for the delay but thank you so much for your response (and the time you spent on it). This really helped me visualise what I needed to do :slight_smile:

I do have one question, how does your CASE Switch Start node have 4 outports? The reason that I have 2 Case Switch nodes (Inner and Outer) is that in my KNIME version it is only possible to have a maximum of 3 cases.
image

But I do agree entirely that it looks much cleaner if this could all be done with one Case Switch :slight_smile: :smiley:
Thanks.
tp

1 Like

Hi @taylorpeter55

This was an enhancement in V4.5.0 ( AP-15521: Case Switch (replacing old “Case Switch (…)” nodes, now with dynamic ports))

Re,
Arjen

2 Likes

@ArjenEX ahh ok - thanks very much.

Hi @taylorpeter55

I’m glad that the explanation gave you some insights.

And that is right, as @ArjenEX said, that was an enhancement in that version, thanks for the answer.

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