Multiple script/condition for a watcher


(Benjamin Peere) #1

hello everyone,
i am wondering if it is possible to have multiple conditions or script for a watcher, to do Something like this :


or like this :
image
obviously this doesn't work, but i would like to know how to make it work so i can create only 1 watcher for all my conditions instead of 6.

thanks for your help and your reply!


(Alexander Reelsen) #2

hey,

you can just do return ctx.payload.foo > 12 && ctx.payload.bar != 'baz' and that will work.

--Alex


(Benjamin Peere) #3

thanks for your reply!
i tried this :


but it still doesn't work


(Alexander Reelsen) #4

Please stop using screenshots and use snippets.

Also, please stop telling that it doesnt work, but try to provide context. What exactly does not work, is there an error message, is there an exception, have you tried to run the execute watch API and can you paste the output.

I suppose that you cannot access payload because it must be ctx.payload, please check the existing examples, we have a fair share of them in our examples repo


(system) #5

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