when using the “IN” condition in a mysql query does not work.
a simple query i have tried
SELECT * FROM mifostenant-default.m_code_value where code_id in (30 ,31)
i tried to pass it as a variable and also i have tried to hard code it to see if it was a wappler bug, the query works,
however only returns the data for code_id 30, and it disregards 31
i have tied square brackets, and it does not work, can you confirm it does on your end?? if so, can u send me a screen shot, i Have also tried putting it in quotes etc.
I have used this a few times so I know it is working, I will take a look through some of my old code to see what i did for you, but could you try not using any brackets at all, as I think Wappler auto adds them in for you, so just enter 31,32 without anything else. Let me know if it works please, if not i will start a hunt for what i did quickly.
I found one of my old queries where i know it worked however it is different to your use case mine was
country IN mexico,canada using no brackets or quotation marks, but yours are numbers, the only thing i can imagine is maybe your numbers need the .toNumber() formatter as they might be getting parsed as strings rather than numbers.
I will continue looking but in the meantime can you try adding the .toNumber() formatter to your numbers possibly.
This might be a very silly thing to ask with regard to this, but i just tried my country query as explained above again and had to do that in exactly the same way as @TomD explained, to pass a complete string and then split it on a character. So that is how the IN Operator is working within the Database Query Builder.
Why then can i use this with the same IN operator as the query builder but within the Users and Permissions. NOTE: value admin,groupadmin
@johnny.hajjar I tested @TomD solution and it worked for me.
{{‘31,30’.split(",")}}
Single Quotes around the numbers separated by a comma, in the split though those are double quotes then a comma then more double quotes.
Just making sure in your split you did not do 2x single quotes which made it look like a double quote.
@paul, the IN you mention for user permissions has nothing to do with the IN in the query builder. @TomD you don’t need to use split, just enter an array there, just like @s.alpaslan showed.
@johnny.hajjar if you see an error 500 there when using an array, we call @patrick here to check this for .net
Thanks George, yes indeed it seems to be bug, all the above just didn’t seem to make much logic, and certainly not the Wappler way of keeping this simple. i look forward to a resolution, yuk im stuck again @patrick @George @Teodor