Query builder with NOT IN clause does not work correctly

OS info

  • Operating System : Mac OSX 20.4.0
  • Wappler Version : 3.9.9

Problem description

I created a query with NOT IN clause to exclude the first two ids of the table, but it doesn’t work correctly, the query returns an id value which must not be present as shown in the attached image,
so i created the same query with a custom query and it works fine.

Create a query with query builder

Create custom query

Result google chrome dev tools, the query returns an id value that must not be present

Hi,

Wappler expects an array to be passed in the query builder UI for IN operator.
Try [1,2].

As for custom query, Wappler/SQL-parameter does not support array for IN operator. Hence the comma separated values work there.

If you ever need to use IN with a parameter in custom query - you cannot in Wappler.
You will have to use find_in_set or equivalent in your SQL DB and configure that.

Hi,

It seemed strange to me that two identical queries could give two different results, but now I understand thanks sid :+1:.

I tried to use square brackets in the query but it doesn’t work,
However, since the values I need to pass are the same, I will be using a custom query

Oh yes. My bad.
That just converts the value into a string like "[1,2]" and not an actual array.
Here's another way you can try:
Create a variable with set value step and set its value as 1,2.
Then, in query, set var1.split(',').

The IN and NOT IN operator expect an array, not a comma separated list.
Use: {{"1,2".split(",")}} as a value.

OK this way it works perfectly

Thank you guys