Is there a way to set a default value, in case there is no existing value, in a change node ?
I can only find examples in function nodes.
Thanks
/Robert
Is there a way to set a default value, in case there is no existing value, in a change node ?
I can only find examples in function nodes.
Thanks
/Robert
You should use a switch node, to check if a value exists or not, before the change node.
That's a good idea. I did not even think of that.
Thanks
You could use JSONata directly in the change node also.
e.g.
[{"id":"9963d61a.80316","type":"inject","z":"c791cbc0.84f648","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":280,"wires":[["a6ff5443.56f208"]]},{"id":"a6ff5443.56f208","type":"change","z":"c791cbc0.84f648","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$exists(payload) ? payload : \"default\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":240,"wires":[["aa51af73.3bbed"]]},{"id":"c3699500.ddef2","type":"inject","z":"c791cbc0.84f648","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":200,"wires":[["a6ff5443.56f208"]]},{"id":"aa51af73.3bbed","type":"debug","z":"c791cbc0.84f648","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":280,"wires":[]}]
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.