The condition in the database query does not work

Wappler Version :last stable
Operating System : Mac
Server Model: NodeJS
Database Type: PostgreSQL
Hosting Type: custom

I need that when a zero filter value arrives, the query returns all values ​​and does not take this value into account. And when it was greater than zero, it was selected accordingly. But it doesn't seem to work.

What about using a Condition in your workflow and having two different database queries?

image

As an example, here is how I create APIs. In the GET request, first, I check to see if an id is sent, then I will query for the individual record. Else, I will return all records.

image

Well, I finally know this method, only I have only 7 types of filters and you can estimate the number of combinations :joy:

I see. I haven't used the conditions much, so I'm not sure if it can do evaluations. @Teodor shows an example here.

Also see this.

1 Like

What i see in your video should work fine.
Have you actually tested this in the browser, on your page, where a real value is assigned to your GET param? What i see in your video is just testing it in the query builder. These conditions won't actually work in the query builder as the query from the query builder is dynamically being generated on the server and will generate a different query depending on your conditions.

Always test your queries with an actual data, in a real browser.

Yes, thanks, I was able to configure this in a real request

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