Filtering Database Query with an URL Parameter no longer working (but works with custom query builder)

Filtering a database query via a URL parameter should work as described in: https://docs.wappler.io/t/filtering-database-query-with-an-url-parameter/2868

Actual behavior

Nothing is returned. However, creating the same query manually via the custom query builder returns results as expected.

How to reproduce

  1. Declare a url variable - in my case: ‘id’ (lower case) on the app side.

  2. Create an action file on the server-side and declare a variable under the GET portion and call it ‘id’.

  3. Create a database query and filter it by the variable id:

  4. Create a custom database query with an identical logic:


    You should have something like this:

  5. Create a serverconnect on the app side and make sure the id is filled in.
    Annotation 2020-04-30 110957

  6. Test your ‘normal’ database query in a page (any column). It returns nothing, as if the url parameter wasn’t passed on.

  7. Test your custom query - it returns what you expect.

And that is because your second filter is wrong:

The IN filter expects an array … not comma separated list:

1 Like

Oh, thanks @Teodor, I definitely did not know that! :+1:

I don’t think anybody would ever guess this is how you need to use IN in a query - that’s why this issue has cropped up so many times. If you were writing a SQL query you would write:
WHERE id IN (1,2,3)
… you wouldn’t need to convert it to an array.

It would be helpful if something could be added to the UI to indicate this. I doubt if anybody would get it right first time or without asking for help.

1 Like