I want to conditionally set the value of a flow.context
based on the msg.payload
value
i am able to achieve the same with following, (see first three lines), but is there an easy way (less code/better code) I have a bunch of them to set.
PS: the value that is checked is actually a string "__null", i have used a slice function before this node
if (msg.M00==="__null"){
flow.set("M0009","_____0");}else{
flow.set("M0009", msg.M00)};
flow.set("M0109", msg.M01);
flow.set("M0209", msg.M02);
flow.set("M0309", msg.M03);
flow.set("M0409", msg.M04);
flow.set("M0509", msg.M05);
flow.set("M0609", msg.M06);
flow.set("M0709", msg.M07);
flow.set("M0809", msg.M08);
flow.set("M0909", msg.M09);
flow.set("M1009", msg.M10);