How is it possible to create new flow variables in nodes?

How is it possible to create new flow variables in nodes?

1 Like

Any value in a column can be turned into a flow variable.

Simply use the TableRow to Variable, and now the first value in each column is converted to a variable. Note this process fails if any column has a missing value, so you may wish to use a Column Filter first to isolate only the columns which have the value you wish to create a variable from.

If you want all the values in a column to be a variable, use the TableRow to Variable loop start, this must be completed with a Loop End further in the workflow

Simon.

Thanks, but what I'm trying to do is to create a FlowVariable inside the NodeModelClass without having to create a table for the TableRow2Variable node.

Basically, I want to put the user input directly into a FlowVariable without additional nodes.

1 Like

push to variable.
refer to source code for table row to variable node.

1 Like

Hi,
here’s what I use:

@Override
protected PortObject[] execute(
final PortObject[] inData, final ExecutionContext exec
) throws Exception {
notifyViews(null);
logger.info(“Executing XNodeModel…”);
String varstr = params.getString(0); // this command gets the user input from configure
pushFlowVariableString(“MY_STRING”, varstr);
return new PortObject[]{FlowVariablePortObject.INSTANCE}; //if no other output
}

I hope it helps.

Regards
Guido

1 Like

Great, it worked fine. Thanks !