Trigger Process Based on Specific Months in a KNIME Workflow

Hi KNIME Community,

I have a KNIME workflow that runs processes specific to certain months within a quarter. The workflow is set up to execute twice per quarter as follows:

  • February and March
  • May and June
  • August and September
  • November and December

I already have a variable that represents the current month and current number. I want to create a trigger process where, for example, if the current month is February, only the process specific to February will run, and the rest will be skipped and so on.

What is the best way to set up this trigger mechanism? I have this initial set-up, but I’m not sure how to configure it properly and to connect the process for other flows and so on.

Any guidance or suggestions would be greatly appreciated!

Thanks in advance!

Hello @Heldyyyyy,

you can use CASE Switch Start node, control it with flow variable and connect proper output port with proper workflow branch. Just need to do mapping of flow variable holding month name/number. If February = 0, March = 1, May = 2…

Br,
Ivan

1 Like

Hi @ipazin,

Thank you for your solution! I’d like to ask a follow-up question regarding the Case Switch Start process. In my workflow, I have two green boxes:

  1. The first box retrieves the data from one of the input ports to determine the month and tags it with the corresponding port number that I assigned per month (as per your suggestion) in the Table Creator. (My problem here is that it has historical files from the previous dump, so there is multiple months but i sort the month in descending order to get the first row as latest month)

image

  1. The second box extracts the variable for the current month from the current data dump file and tags it using the Rule Engine node.

I tried connecting the first box to the Case Switch Start node and using the “port” variable generated by the Rule Engine node to control the switch. However, I encountered an error: “Execute failed: Invalid output port ‘6’ specified.”

This is my configuration in CASE Switch Start (i use the variable “port” from the rule engine node of the 2nd green box)

Could you help me understand what might be causing this issue and how I can resolve it?

Thank you in advance for your help!

I believe one cause of the error in the case swtich is because my sort table has multiple port number in the port column (since it has historical months and the table creator tagged ports in specific months), i did try to use row filter to only get the 1st row so that it will only read 1 port value and connect it to the case switch but it has the same case switch error.

Hello @Heldyyyyy,

not sure about your design and exact data you have in your tables but seems to me you should use variable input/output ports on CASE Switch Start/End nodes. I have created a little example for you so you can check it out. This is workflow design:

You can now change input month in first Table Creator and different Math Formula will execute. (Month covered in Rule Engine are December, January and February.)

Workflow is attached so you can give it a try. Workflow version is 4.7.7.
ipazin_CaseSwitchExample.knwf (19.0 KB)

Br,
Ivan

2 Likes

Hi @ipazin,

Thank you for the clear and detailed example! This really helps me understand how to use the Case Switch Start and End nodes with variable input/output ports.

1 Like

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