[Feature Request]Additional tests in switch node

The switch node has a number of tests and the opposite of them
e.g
== and !=
< > >= <= etc
is true and is false
is null and is not null
is empty and is not empty

but there are others with just one method
has key
is between
contains
matches regex
is of type

I'm often wanting "not contains" and either end up with an empty output wire by using contains first and stopping on 1st match (visually jarring) or a bit of JSONata

Are others finding they need opposites of any of the others?

I'm thinking if its just me :slight_smile: its just a little FR but maybe a floodgate would be opened :slight_smile:

Completely reasonable imo.
Pretty sure there is/was a thread around this already.
And yes, I've occasionally wished for these.


My thoughts were rather than make a long list even longer (which if memory serves was the reason it got no traction) would be to not add the opposites but instead, offer hem with a dropdown preceding the input

E.g.

[Has/Does not have] key
[Is / is not] between
[Does / Does not] contain
[Does / Does not] match regex

Or perhaps simpler (but less friendly) just an " invert" option alongside them.

5 Likes

It think this is more desirable as it is less unambigious than an "invert" option, which could introduce confusing side affects.

Although I have to say that I am sometimes confused by the false/null/empty - as javascript is the worst for dealing with these types.

I think the invert option would add to the confusion. Invert matches regex, invert is between...

Some options are only applicable to a particular datatype. Has key only for objects, contains & regex only for string, Is true only for boolean, etc.

Would it be possible for the type specific options to be presented as a second dropdown, only when is of type selected and when relevant ?

  • Is of type boolean AND is true
  • Is of type object AND is empty
  • Is of type string AND matches regex

I am not at all sure if this could be coded as a non-breaking change.

I see a lot of suggestions that they all could do with doing but has anyone ever actually wanted one that was missing apart from me and the contains one :slight_smile:

1 Like

at least one :point_down:

Wish isn't wanted - we all wish for stuff in NR :slight_smile:

Jeeez man. yes Yes YES there have been times I have wanted (needed) and ACTUALLY done the whole "has key => no wire, otherwise => wire" and the contain and the regex too. (but not the between)

2 Likes

Looking/using your first post for my reply.

Where you want "not contains".
Why not do this:

contains (what ever it is)
otherwise

and use the otherwise output?

Just a thought.

Yes it would get messy if you have a lot of that type of filtering/switching to do as each would then require their own switch node.
But just mentioning.

I want to avoid an empty output just sitting there

Yeah fair enough.

't was just a thought. :wink:

I really need to read things more than once before replying.

1 Like

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