Any way of effectively swapping the outputs

I believe the answer is no but I'd thought I'd ask as there is no "doesn't contain" option in the switch node

Would just help in tidying up wires - not critical issue :slight_smile:

[edit]Maybe some simple JSONAta?[/edit]

Could you not use a regex?

Try this example flow the jsonata is $contains(payload, "simon says")!= true

[{"id":"1814bb4.c8873c5","type":"switch","z":"cb9367c5.85f7e8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"jsonata_exp","v":"$contains(payload, \"simon says\")!= true","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":520,"wires":[["88cd6414.436a6"],["c2c17797.73541"]]},{"id":"411905fc.24a224","type":"inject","z":"cb9367c5.85f7e8","name":"","topic":"","payload":"foo","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":460,"wires":[["1814bb4.c8873c5"]]},{"id":"f604288b.6b21d","type":"inject","z":"cb9367c5.85f7e8","name":"simon says","topic":"","payload":"well simon says I'm good","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":560,"wires":[["1814bb4.c8873c5"]]},{"id":"88cd6414.436a6","type":"debug","z":"cb9367c5.85f7e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":480,"y":460,"wires":[]},{"id":"c2c17797.73541","type":"debug","z":"cb9367c5.85f7e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":560,"wires":[]}]
1 Like

JSONata:

$not($contains(payload, 'simon says'))	
2 Likes

I usually avoid RegEx if possible

But I'm sure it would work - can you supply the magic incantation?

Thanks @cflurin and @zenofmud - I gave solution to @cflurin as marginally shorter :slight_smile:

1 Like

Off the Top of my head (?!.*(simon says)).*$

I would to, I didn't see the $not or would have used it also. But I should get bonus points for providing a flow! :rofl:

2 Likes

BTW - use contain a lot (in my Alexa parsing flows) so this technique will be quite useful for me :slight_smile:

And even I can understand the JSONata used :slight_smile:

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.