Variable Creator


I want to use the Variable Creator node, to create variables that depend one on another. E.g. I want to build an XPath where the value of an attribute shall be given from the outside. So I would like to create a variable containing a placeholder string and insert that into the other variables such that I later can replace the placeholder with the actual value along the line

Is that possible? I will try to cough up a workaround.



Guess, that is as good as I can get it.

Hi Thiemo,

Alternativelly, I would go for:

  1. Table Creator node to create the first variable.
  2. String Manipulation (Variable) node to create the next variable using functions available inside that node.
    Please keep in mind potential switch between path, string, and variable type of data.

Happy KNIMEing,

1 Like

@Kazimierz Thanks for the proposal ;-). I started like that, but using variable creator instead of table creator node (maybe wrongly named by you?), but one needs to have for each and every variable a single string manipulator node, does one not? Very cumbersom.

Hello @Thiemo.Kellner
You can alternatively go ahead with ‘Java Edit Variable (simple)’ node. This is a simple script node, and very easy to be configured:

Here there is an example on how to?



@gonhaddock Thanks for the example. Am I mistaken that I would have to use a node for each variable? The none-simple variant allows to create several variables in one go, but I do not see the advantage over using my workaround - which seems to me not that much of a workaround.

You are right, I thought on a processing inside a loop. Forget about

1 Like

Hi @Thiemo.Kellner , you could give these components a try.


I have just written them as it seemed like a “nice idea” :wink: and they are based on another component from a few days back. They borrow the flow variable “tag” syntax described in the Text View node documentation

Basically, if you have your three variables “xpath first part”, “type” and “xpath name part”, you can create a further string variable based on these by using the Dynamic Variable Creator and giving it the value:

$$["xpath first part"]$$["type"]$$["xpath name part"]

Alternatively, if you have may such variables to process, you can create them all using a variable creator with the above syntax, and pass them to the Dynamic Variable Replacer (Multi-Variable)

A workflow giving a simple demo is available here:

The main downside to the components is going to be performance. If you were needing to perform this replacement in a loop containing a large number of rows, then executing the components each time would be dramatically slower than coding the replacement as you have already done with a java snippet. There will always be that trade off between dynamic and bespoke code. However, this may be of interest depending on your use case.

They are new, so you’ll need to check they work for you, and if you do give them a try, please let me know if you encounter any issues, or have any suggestions for improvement.