Changing values Workflow Variables

Hi All,

I’ve been trying to update my workflow variables defined in the Knime Explorer / Right click on flow / Workflow variables. I’ve gotten as far as updating the variables in the workflow using the [Table row to variable] but somehow this doesn’t update the variables in the entire workflow(is this called global workflow variable ?) but only if you connect them through a connection. I want to use it for a legacy flow where there are lots of interfaces with workflow variables that interface directly with the Global workflow variables in lots of different nodes this has already been built.

When searching on this topic it leads to loads of old topics and connections. Would really appreciate some help.

I’ve made a example workflow.

Knime_forum.knwf (10.3 KB)

Hi,

This is not possible to change flow variables globally except for the global variables by modifying them in the same way they are defined (a global variable can be defined by right clicking on the workflow in the KNIME Explorer panel and selecting the “workflow variables…” option) which then requires all the nodes in the workflow to be reset.

So there is no node to modify the global variables globally. You can modify any variable in any flow but the changes are applied to the rest of that flow, not globally.

Here is a suggestion for you:
To modify a global variable for several flows, just feed the updated variable to the variable ports of all the nodes which need the modified variable. For example you can edit the global variable with a “String Manipulation (Variable)” or “Math Formula (Variable)” or any other nodes that can do such a job and then feed the variable to the variable ports of the desired nodes (the same as you did in your example workflow).
You can also create a new variable with the same name and feed it to the rest of your workflow but be aware that the new variable will replace the older variable as long as they have the same type otherwise they will both coexist.

Best,
Armin

P.S. Welcome to the KNIME community, here we help each other to solve problems and learn more about KNIME and Data Science. :blush:

5 Likes

Thanks armingrudd your answer guided me to the realization that all the subsequent nodes hold the changed variable. This enables me to connect the changed variables once at the start of the flow and use them throughout.

3 Likes

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