Idea about existing trello item (compound rules for switch node)

Hi folks,

Just to make it clear: this is NO feature request.
It is only an idea about an existing Trello item (switch-add-compound-rules):


Today at work I had to create a compound filter in the Zabbix user interface.
Zabbix allows following options on the screen to combine multiple filters:


So Zabbix allows this:

  • Use AND for all filters

  • Use OR for all filters

  • Use AND/OR which means it will use and for the first N filters and OR for the last filter. For example -"(A AND B AND C) OR D". But I'm not sure if anybody uses that option, because the next option is much more flexible.

  • Use "Custom expression" to enter a free-text expression like this:

This works fine and it is very flexible. Only disadvantage is that Zabbix doesn't validate the expression in a user-friendly way.

When I saw this Zabbix screen, I immediately thought about the Switch node ...
A Switch node with an editableList on top containing all the current typedInput's, and another editableList containing expressions and the corresponding output numbers ...

Although most probably Nick and Dave had already something much better in mind already.
But I don't see a link to a design document in Trello, so I'm not sure.

Anyway, it is only an example how other software does something similar.
Nothing more nothing less ...


1 Like

Thanks Bart.

It isn't an item we have a design hiding in the back-pocket. One of the inhibitors has been the need to come up with an intuitive UI design for it.

Thanks for sharing an example of how Zabbix handles it - certainly useful to help stimulate ideas.

1 Like

I really like this design. This would take away a lot of the times when one either needs several switch nodes in series or parallel or a function node. At least for me this would clean up a lot of my flows nicely. I can see that coming up with an intuitive way to integrate this into the current switch nodes up would be the hardest part.

BTW perhaps my description is not clear for everybody. Here a "quick" mockup, just to explain it better:

1 Like

My concern is that gets quite complicated quite quickly - especially for all existing flows that don't use compound rules. For those cases (again, 100% of existing cases) you have to add both the rule and the port mapping to go with it as two separate 'things' and hope you keep them in sync. I'm not sure that is very intuitive. To understand what port mapping is doing, you have to constantly refer between the two tables - you can't just 'read' it. This is as much a critique of Zabbix's approach as it is however it might translate into the Node-RED UI.

Before you go too far down this path, one of the main requirements of the compound rules feature is to be able to define rules that check against multiple properties of the message - msg.payload > 80 AND msg.topic === "temp" for example.


No arguments against that!

You can do that already, by hand coding the tests in jsonata. Possibly not as convenient as a GUI where more complex rules are required but very powerful.


1 Like

Yes, you are absolutely right - but it does limit you to one rule per node (with only true/false outputs).

There are other tricks you could do you use JSONata to build a single value containing all the bits you want to test... but they are just that, tricks.

And the existing approach of having multiple tiers of Switch node can also be used.

The idea around compound rules is to make it all a bit more intuitive and self-contained.


Ive used this before to good effect...


It supports plugins

  • i.e. we could shoehorn the typedInputs into it
  • could output JSONata or alaSQL or eval code

Yes, I agree. I just wanted to point out that way of using the node which others may not have thought of.
Though I am not sure how often I would need more than that provided by basic switch node usage or using expression evaluation using JSONata.

Hey Steve,
I had seen that one also, but not used yet.
I'm going to work on the svg node next week, so don't expect a node-red-contrib-query-builder from me :rofl:

1 Like

my concern is that again, unless extremely clear, folk will presume this also works across two different messages (ie is capable of AND-ing two inputs)

I think the original thoughts around this were from back here -!searchin/node-red/dean$20cording$20switch|sort:date/node-red/TX302_NSoDc/KrPBC-8NAAAJ
(which may give an alternative view)

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