Database toggle conditions problem

Wappler 3.0.0, osx Catalina 10.15.5, NodeJS
Used to be working and no idea what happened :wink:

Trying to return all entries if type_filter is not selected (ie. passing -1)
ccu_filter works fine but is disabled atm.

Works and returns filtered data : ccu_filter=&type_filter=3
This returns nothing, but no error in console og db complaints : ccu_filter=&type_filter=-1

When checking the Server Data bindings there seems to be something going on.
Have seen -1 beeing switched to +1 in some cases

The filter value is shown in Design as:image
In code view:

Or maybe it’s just a simple mistake at my end…

 "wheres": {
              "condition": "AND",
              "rules": [
                  "id": "ccu.c_ccu_type_id",
                  "field": "ccu.c_ccu_type_id",
                  "type": "string",
                  "operator": "equal",
                  "value": "{{$_GET.type_filter}}",
                  "data": {
                    "table": "ccu",
                    "column": "c_ccu_type_id",
                    "type": "text"
                  "operation": "="
              "conditional": "{{$_GET.type_filter != -1}}",
              "valid": true
            "orders": [
                "table": "ccu",
                "column": "c_tag",
                "direction": "ASC",
                "recid": 1
            "query": "SELECT ccu.c_id, ccu.c_tag, ccu.c_active, ccu.c_ccu_type_id, t.ct_name\nFROM ccu\nLEFT JOIN ccu_type AS t ON (t.ct_id = ccu.c_ccu_type_id)\nWHERE ccu.c_ccu_type_id = :P1 /* {{$_GET.type_filter}} */\nORDER BY ccu.c_tag ASC",
            "params": [
                "operator": "equal",
                "type": "expression",
                "name": ":P1",
                "value": "{{$_GET.type_filter}}"

Redid the query a bit.
Conditions in the Database Query builder does not work:

Doing the conditions in Action Steps work: (Are conditions in Database Query builder broken ?)
The type_filter is only added to the first paged query

Query params are always strings, so if you want to compare them with numbers you need to convert them to numbers first…

The query params are ok. Returns what they should

It’s the condition that does not work as I expect. When I pass no params I just want to return unfiltered data.

Tried to pass the default value as an empty string
Checked that the value passed is “”, but condition is stil active
Also tried to use .length() == 0 and <1

Whats the best practice ?


Yes just supplying the field as condition should be enough.

Maybe is something specific to the new NodeJS implementation - @patrick will check it out

I too had this same issue where the toggle condition seemed to have no effect on if it applied the query filter.

I raised it the the other day in another post but not sure if it was an official bug or general post.

For me, I’m using a NodeJs app and have not been able to get the toggle condition to work at all.

Here an update for the conditionals not working with nodeJS.

Unzip (2.1 KB) in lib/core.
Unzip (1.9 KB) in lib/modules.


Awesome Patrick
It’s working as it should :+1:

This is now fixed in Wappler 3.0.1

1 Like

This topic was automatically closed after 24 hours. New replies are no longer allowed.