Create this Query in Wappler

Yes - definitely getting the results I expect.

Here are the steps:

image

Turning on output only for the Set Value line, this is the raw data returned by running the query:

{"excl_ids":[5670,5631,5613,5431,5155,5047,4919,4910,4734,3997,5812,5814]}

image
Response for me is still:
{"aa":["30","16","11"]}

code_value_id is numeric in DB. Don’t know why its coming as string. I see output for you is numbers.
Are you using .NET or PHP? I am using .NET with MySQL 8.0 odbc driver.

I’m using PHP.

Must be IIS related then.
@patrick can you please check this?

It’s strange that the results are being returned as text. Is that definitely an issue with the array conversion or is that how the results are returned by the first query? Also, I think the query should work even if the numbers are in quotes, so perhaps there is another issue.

Amazing @George

Exactly what i asked for many months ago

1 Like

NishKarsh, did you try NOT editing the file and just adding the {{queryname.groupBy(‘id’).keys()} into the query editor conditions as above, worked perfectly for me

I deleted the edited server action. Made this from scratch and added the groupby in condition and set value.

Yeah… quotes is probably not the issue.

Shot in the dark, try {{query1.groupBy(“id”).keys().toNumber()}}?

Error: Can not convert Array to Double. :sweat_smile:

which stage is generating the error, i am not having the same issues as you,

query1 (get exceptions)
query2 get results condition NOT IN {{query1.groupBy(“id”).keys()}} and {{query1.groupBy(“id”).keys().toNumber()}} both work via the visual builder for me?

The condition in query is generating error.
The group by itself is working, but when used in condition parameter for NOT IN, it says Cannot convert array to string.
I am able to print the value of group by using set value, so I know that part is working.

Are you testing this on IIS with MySQL too?

Was testing on Apache/Mysql, will re-test on my local IIS (Server 2012 R2) and report back

No errors on IIS/PHP/ MySQL at my end

MySQL driver version?

PM sent with config info link

1 Like

Some drivers don’t return the results correctly and numbers can be returned as string. Using them in the query should be no problem, most databases don’t matter if you pass the variable as number or string, they will convert it to the correct type. So id = 1 and id = '1' both will work the same.

@nshkrsh What is the query2 you now have, did you use the aa value for the NOT IN condition?

Yes. Tried it with aa and writing the query with formatter directly too.

Do you get an error now, what is the result? Also when the result is incorrect, enable the Debug in the select action, this will output the query and parameters used.

image

The error is:

Messaging you a link to check the debug output.