Generic Javascript View Flow Variables


is it somehow possible to dynamically create output flow variables in the Generic Javascript View node?


1 Like

Dinamically? Did you mean a variable number of output flow variables?

Yes exactly. I know the number of output flow variable only at the term.

Hi @ptrwlr,
could you please post a short example what you exactly want to do?


I can add a flow varaible output manually in the node configuration.
What i want is to create a new flow variable output dynamic by coding with javascript.

According to me the only way to do this is collapse your vars in a complex string (with separators).
The reason is that you have to access to Flow variable names in configure phase.
If you want create Flow variable at runtime next nodes cannot know variable names.
Can you explain your problem?

Hi @ptrwlr,

this looks for me also static because you also predefine variables. You can do this with the java edit variable node.

If you want to generate variables based on data records you can use Table Row to Variable node,



i know that.
But if i predefine variables, how can i change the values inside the Generic Javascript View node?

Or how can i define a new flow variable in the node by coding with javascript?

to change the content of a variable you have to use one of the java edit variable nodes. With a java script node you only can modify the content of a table.



I dynamically create a number of x checkboxes at run time. I don’t know how many of them are before. Now I want to create a flow variable for each created checkbox in order to be able to process the user selection further.

If you dynamically create checkboxes, I think that their name is anything like “check_0”, “check_1” and so on.
Can you output only the number of checks in a number var?

Hi pigreco,

no names don’t look like that so this is not an option for me.
But thank you for your suggestions.

Does anyone have any other solutions?

As I said in the first post (even if I don’t like that solution) you can export a single String variable with concatenated checkbox names using a secure separator (char not used in checkbox name, pipe ‘|’ for example).
In next node you can split variable value by separator and obtain your vars.

Hi pigreco,

thanks for your suggestion but that’s no solution for me.

@KNIME Team Member
Is there any solution?

I suggest you set a single flow variable like @pigreco suggested, but use JSON instead of some custom format:

$(function() {
    FLOW_VARIABLES["variables"] = JSON.stringify({
        param1 : 4,
        param2: "test"	

Then you can use a Variable to Table Row followed by a String to JSON and a JSON to Table to get a table with the keys of your JSON being the columns and the values in a single row. With a Table Row to Variable you can then turn this into a set of flow variables.
Kind regards,

1 Like

Hi Alex,
Thank you!

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