Is the 'Toggle Condition' feature supposed to be working in Beta?

Not raising this a bug, as not sure if i’m doing it wrong, or if its not supposed to be working.

I’m just wondering if the ‘Toggle Condition’ feature in server connect query builder is supposed to be working in the current beta?

If so, how exactly does it work? Is it supposed to accept a true/false condition, and if met the condition will be either applied or not applied?

In previous versions and following older guides, i always put something in there when using a filter, and it would basically not apply the condition if that GET filter was empty (like a search field for a DB query)

Nothing i do with it now seems to work. Here is a simple example when trying to apply a filter on a boolean field in my DB.

I am looking for this answer also. The docs are not updated with the new details of this. Is this an expression that results in including or excluding a condition?

I believe it is working, and in answer to my question:

When the condition is met (i.e. True), then the conditions WILL NOT BE APPLIED

I made a note of this for my own records as i had to keep figuring it out :slight_smile:

1 Like

Wow, that seems counterintuitive, but thanks. lol :wink:

I guess it is saying “Hey, when do you want me to toggle this condition off for you?” Oh, now, when this toggle feature is true? sure no worries!"

At least that’s how Wappler talks in my head :slight_smile:

I think a common use would be a condition like {{$_GET.filter}}, so only apply when there’s a value there, otherwise skip. Programmatically it’s backwards, so then I’d have to do this every time: {{!$_GET.filter}} LOL :wink:

Seems now I can't even build a toggle condition. It keeps erring out with

{"status":"500","message":"Cannot read property 'get' of undefined","stack":"TypeError: Cannot read property 'get' of undefined...

All I entered was {{$_GET.filter}}. Is there a special way to enter $_GET expressions there? If I remove it, or enter just '0' or '1' it works fine.

Same way as any normal data binder / picker.

It should be working, here’s a fairly complex one of mine:

Also, this use case is how it is used normally as well. I believe that's the same as a more complex condition returning TRUE.

I.E if there is a value in {{$_GET.filter}} then that condition is TRUE and the condition will toggled OFF / wont be applied.

Again, this is just my interpretation as the conditions have done my head in at times as well, but they all work fine now after a bit of tweaking etc.

Ok found my issue. Seems a grouped condition was inside an empty parent group. lol

I just tested it an it’s operating as expected. If {{$_GET.filter}} exists (true) the query is applied, otherwise it’s ignored.

That's not how it works.

The filter is applied when the condition is met.

Ok… sorry for the confusion then… it still gets me muddled up. I have it all working though… and I think @jamesw got there too. Feel free to delete my posts so as to not confuse people