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

**URL:** <https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963>\
**Category:** Core Development\
**Created:** [25 June 2020 11:07 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963 "2020-06-25T11:07:42Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [25 June 2020 11:07 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/1 "2020-06-25T11:07:42Z")

</div>

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](https://trello.com/c/vkrqUBRi/101-switch-add-compound-rules)):

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/7/f784bcaa1bdee6e7229f4c0e4546adfc72fd5fc0.png)

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:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/2/62a873312169d91d477e011ea5edfa5291ae487e.png)

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 ...

Bart

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [25 June 2020 12:40 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/2 "2020-06-25T12:40:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)\
**Post date:** [25 June 2020 12:52 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/3 "2020-06-25T12:52:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [25 June 2020 13:09 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/4 "2020-06-25T13:09:12Z")

</div>

> [@BartButenaers](#):
>
> A Switch node with an editableList on top containing all the current typedInput's, and another editableList containing expressions and the corresponding output numbers ...

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/2/92364b65d27e47afa3be4af1d7566bb1a374dbc9.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [25 June 2020 13:17 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/5 "2020-06-25T13:17:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [25 June 2020 13:26 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/6 "2020-06-25T13:26:44Z")

</div>

> [@knolleary](#):
>
> ou keep them in sync. I'm not sure that is very intuitive.

No arguments against that!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 June 2020 15:00 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/7 "2020-06-25T15:00:17Z")

</div>

> [@knolleary](#):
>
> msg.payload \> 80 AND msg.topic === "temp"

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.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/1/c195fa45915f5cece68248f61514b5dbec80d6b3.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [25 June 2020 15:03 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/8 "2020-06-25T15:03:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 June 2020 15:13 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/9 "2020-06-25T15:13:50Z")

</div>

Ive used this before to good effect...

[https://querybuilder.js.org/demo.html](https://querybuilder.js.org/demo.html)

Helpful?

It supports plugins

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 June 2020 15:16 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/10 "2020-06-25T15:16:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [25 June 2020 15:38 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/11 "2020-06-25T15:38:41Z")

</div>

> [@Steve-Mcl](#):
>
> Helpful?

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 🤣

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [25 June 2020 15:57 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/12 "2020-06-25T15:57:38Z")

</div>

> [@knolleary](#):
>
> multiple properties of the message - `msg.payload > 80 AND msg.topic === "temp"` for example.

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 - [Redirecting to Google Groups](https://groups.google.com/forum/#!searchin/node-red/dean$20cording$20switch%7Csort:date/node-red/TX302_NSoDc/KrPBC-8NAAAJ)  
(which may give an alternative view)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 August 2020 15:57 UTC](https://discourse.nodered.org/t/idea-about-existing-trello-item-compound-rules-for-switch-node/28963/13 "2020-08-24T15:57:52Z")

</div>

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