IF Switch warnings

Hello.
I am using KNIME Analytics Platform 4.0.2, and I have an ‘IF Switch’ node in my flow. The picture below shows the part of the flow with the node.

The ‘IF Switch’ node’s port choice if controlled by a variable created in the preceding ‘Table Column to Varible’ node. However, the ‘IF Switch’ node prints warnings about the “Unknown variable “Row0"” into the console every time the flow is reset, so the flow basically opens with the warning. Then additional warnings are pronted after the 'JSON Path” node and the ‘Rule Engine’ node are run. After the ‘Table Column to Varible’ node is run, everything works fine.

Could you please explain this behavior? Why is the warning issued even though the flow has not reached the ‘IF Switch’ node yet? And how should I change the flow to prevent the warnings from appearing?

This is a normal behaviour ( i reproduced it).
The problem is that, when a node is reset, output rows number is an unknown information.
Since you’re using node “table COLUMN to variable”, you will have as many variables as rows contained in rule engine output.
The number of rows has Rule Engine Output is an unknown information until you’ll not run that node.
So IfSwitch doesn’t know that previous node will produce a Row0 variable (it’s dependent by run).

Are you sure you need table column to variable node?

5 Likes

Thank you for your answer. I have used the ‘Table Column to Variable’ node because I only needed a variable made from one column. As by design the flow will always have one row, I thought that it would be better to make one varible from the needed column rather than turn all columns into variables.
But I tried changing that to the ‘Table Row to Variable’ node, and the warnings were indeed gone.
However, I do not fully understand the difference in the behaviour - aren’t output columns also unknown? In fact, the column that is made into the variable that controls the ‘IF Switch’ is made in the ‘Rule Engine’ node, so why do I not get warnings about missing variable on the earlier steps, as I did while using the ‘Table Column to Variable’ node? Does KNIME treat information about rows and columns differently?

Yes, because columns and rows are no properly the same thing.
Column, teorically, is an information about structure of your data and is known even if you have empty tables, no data.
Rows are result of your processing and, teorically, can change according your workflow so you could not know how many rows you’ll see in output from any node.

It’s clear that If you have a node with transposing or dinamic computing of number of columns cause that even column names could not be known.
But generally, number (and names) of columns is a known info, number o (and names) of rows is not one.

1 Like

Thanks again. I’m really trying to understand the basic ideas of how KNIME works, because I’m using it for work, and I need to make sure my flows are made properly.

1 Like

Hi there @a_pavlenko,

welcome to KNIME Community!

Warning message you see is cause configure method which is called each time an upstream node’s settings changes. Although topic about development, it has nice explanation:

Hope this contributes to your understanding :wink:

Br,
Ivan

1 Like

Thank you. It certainly points me in the direction of the things I need to clear up for myself.

1 Like

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