Variable Expression: How to use declared variables in expression of the same node

I have 2 dates declared in Variable Expression as string constants.
I want to add new variable as a combination of previous ones. Recently someone answered the question but I cannot find it.
So, D1 is “7/1/21” and D2 is “7/31/21”
I need to add join(D1,"-“D2”)

Thank you

Hello @izaychik63,

you wrote expression yourself.
join( variable("D1"), "-", variable("D2"))

Are you getting unwanted result with above or error?


1 Like

Ivan, Variable expression does not see variables D1 and D2

I think you’d need to use a single expression:

The node description says as much:

Additionally, intermediate results of functions or calculations can be stored within an expression by assigning them to variables (using ‘=’). This allows that these results can be reused in different parts of the expression after they have been assigned (see Examples).


Thank you, @elsamuel . This is looks as local variables for the section. My hope they could be global for the Variable Expression node.

If you want to set global workflow variables, you can right click on the workflow in the KNIME Explorer panel and select “Workflow Variables”:

You’ll then be able to define variables that will be available to every node in the workflow:



Hello @izaychik63,

I see now what you mean. Using results from one expression in subsequent expressions (and/or defining global variables) is not possible within Column/Variable Expressions nodes. However there are tickets to enhance above mentioned nodes and I have noted your interest there.

For transparency reason you can also use Variable Creator node instead of workflow variables.


1 Like

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