I want to save a value in a flow variable once and then compare it to incoming a msg.payload field in an if statement (using a function block)
I have saved the value I want to compare
then I load it into the colora variable
colora = flow.get(“color”)
now I want to compare that value in color it to a field in an if statement
if (msg.payload.id === colora)
{msg.payload.new= “blue”}
else {msg.payload.new=“white”}
my problem is that it never detects when msg.payload.id actually matches the value in the flow.color field so everthing is “white”.....but I can't figure out the syntax to have msg.payload.id compare to the value in colora. (neophyte to node-read)
what's the syntax for this....or should I forget about using calora and just insert the flow.get into the if statement (and again, what's the syntax)?