Check if flow variable exists - Part 2

Hi,

I try to check if a Variable exists (which it does depending on the data input) in the workflow via the Java Edit Variable node using the “flowVariableExists(var)” method as suggested here:

The Java snippet can check if a flow variable exists. It is described in the node documentation of the node.

But I dont get it to work, so obviously I am missing something. Here is the script of the “Java Edit Variable”:

if (flowVariableExists(v_Row0)){
out_var = "NA";
}
else{
out_var = v_Row0;
}

I also tried the typeof operator (function - JavaScript check if variable exists (is defined/initialized) - Stack Overflow) with the same result - not working.

I may have a solution using the “Python Edit Variable” node that is working so far:

try:
flow_variables['Row0']
except:
flow_variables['var'] = "NA"
else:
flow_variables['var'] = flow_variables['Row0']

I was just wondering what is wrong with the Jave code.

Would be nice if somebody could provide a solution for the Java Edit Variable Node.

Best

A.