This is about the SWITCH
node and it's options.
Ok, second attempt and I hope this effort is better than my other question I asked poorly.
Say I have a message that is an object.
eg:
msg = {"payload":"this is the payload","important_piece":"this needs to be parsed"};
I hope that is correct for structure as I am flying on fumes just now.
I need to allows the message to pass ONLY if the important_piece
is set/there/valid.
There are times when it is just msg.payload
and nothing else. So I do NOT want this message to go through.
So that is where the switch
node comes into play.
But what do I put in it?
is not null
or
is not empty
Sorry, it is an elephant.
But I am having trouble getting my head around it because of my other post and the solution used there to get things to work.
Example flow:
[{"id":"bf7938a4d1c0b9fc","type":"change","z":"0918ee609bf69fc7","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"This is the payload","tot":"str"},{"t":"set","p":"important_piece","pt":"msg","to":"This needs to be parsed","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1900,"y":510,"wires":[["239df70d331c7a67","6051957128a32947"]]},{"id":"43b0a867366e9201","type":"inject","z":"0918ee609bf69fc7","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1740,"y":510,"wires":[["bf7938a4d1c0b9fc"]]},{"id":"239df70d331c7a67","type":"switch","z":"0918ee609bf69fc7","name":"","property":"important_piece","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":2100,"y":530,"wires":[["716870566126c0ad"]]},{"id":"6051957128a32947","type":"switch","z":"0918ee609bf69fc7","name":"","property":"important_piece","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":2100,"y":490,"wires":[["eaf6e8ee778738c7"]]},{"id":"f7d96b70408812c1","type":"change","z":"0918ee609bf69fc7","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"This is the payload","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1900,"y":550,"wires":[["239df70d331c7a67","6051957128a32947"]]},{"id":"716870566126c0ad","type":"debug","z":"0918ee609bf69fc7","name":"debug 65","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2320,"y":530,"wires":[]},{"id":"eaf6e8ee778738c7","type":"debug","z":"0918ee609bf69fc7","name":"debug 66","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2320,"y":490,"wires":[]},{"id":"24ea464f7f379813","type":"inject","z":"0918ee609bf69fc7","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1740,"y":550,"wires":[["f7d96b70408812c1"]]}]