Math Formula (Multi Column) node and flow variable type

Dear all,

I have experienced the following situation:

  • using Double Input node the user defines variable1 in double format equal to e.g. 1 - the variable has double format after this as expected
  • when another flow variable is added (i.e. not to edit variable1…) using Python Edit Variable node, KNIME automatically (?) adds also variable1 in integer type next to the variable1 in double format, so there are two variables of the same name, just with the different type
  • the Math formula node after the python edit variable node shows only integer format of the variable1
  • the Math formula node does not work in case you have set it up before to use double format of the variable1 (“D” before the variable name…)

I found it a bit tricky and not robust enough so I have these questions:

  1. is this expected behavior or bug?
  2. is there any general way how to specify the variable in the Math node (and probably also elsewhere) to use any type of variable format? Interestingly double format of the variable is not an issue even though you specify the integer format of the variable in the math formula node…
  3. I have found the workaround that works for me now by editting the variable1 (/100 and *100) in the Python edit variable node prior the variable1 use in the Math node. The edit results I assume in changing the order of the variable as there is still variable1 in double and integer format, but the Math formula node shows the double one now…
  4. more generally, is there any plan to use also string variable type in Math node? I would find it extremely useful e.g. for logical operator specification via the variable, now I have to use (or am I missing something?) multiple math nodes just with a different logical operator specified…

Thank you in advance for your inputs!

Best wishes,

Hi David,

how flow variables with the same name are expected to behave is described in this thread: Variable Control

Variables with same name but different type are treated as different variables. You can check that simply by connecting a Double and Integer Input node. That is why I’d expect both, integer and double, to be present in the Math Formula node. I’ll open a bug report for this.

The usage of flow variables of type string in Math Formula node has to be discussed. Using flow variables instead of operators makes it almost impossible to interpret the formulas without knowing the flow variable values. But theoretically you could use an if-condition to be able to execute different formulas within one node, e.g. if(variable = 1, “sum”, “subtract”).

I hope this clarifies things for you.


1 Like

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