Can I peek a numeric flow variable regardless of whether it is a double or an int?
I thought peeking a flow variable for a double would return correctly regardless of whether the flow variable was a double or an int, but it turns out I need to handle both cases independently.
Here's my code:
try {
priceProduct = this.peekFlowVariableDouble(nameInputColumn + FLOW_VARIABLE_QUALIFIER); //The Product Price could be a Flow Variable Double or a FlowVariable Int - test both
} catch( NullPointerException | NoSuchElementException e ) {
try {
priceProduct = (double) this.peekFlowVariableInt(nameInputColumn + FLOW_VARIABLE_QUALIFIER);
catch( NullPointerException | NoSuchElementException e ) {}
}
I'm trying to match an input column for "product" with a flow variable for "price". The code above works fine, but it would be more elegant if I could do this in one instruction without the double-nested try-catch blocks.
I don't think so. I need to get the Flow Variable, so I need to first call peekFlowVariableDouble then peekFlowVariableInt. So I would need to cast the Flow Variable itself which I don't think I can do.