Question with SelectValue as ColumnName and "Disable converting queries to prepared statements"

Hi, I'm making a query JSON with SQL (all the operations are made based on an imported CSV file, so there is no need for a Database) and I'm trying to use a drop down Select as a way to use its value as a column name in a query, like this:

SELECT * FROM {{tableSource.data}}
where {{selEmail.value}} = '%gmail.com'

I read that the correct way to do this is using {{"'"+selEmail.value+"'"}} or '{{selEmail.value}}' and that I need to "Disable converting queries to prepared statements" in the resource option, but how can I do so with Query JSON with SQL? As far as I can see there is no way to edit this type of resource.

Maybe it's disabled by default and I'm making some kind of error?

Thanks!

Hi @Pixo , You don't need to disable prepared statements for JSON with SQL.

Here is a link to the documentation for this

I have demo'd this, here is the app and video
demoApp.json

Hi @ugo.ago , thanks for the reply and sorry for being a bit late, but this is not quite what I was looking for.

What I'm trying to do is to let the user decide on which column the query should operate.
This is because I noted that if the column names in the CSV file aren't EXACTLY like in the query, the query won't find anything in the file and result in an empty table.
All this is just so that anytime a user needs to use the app they don't need to enter the file and change the column names every single time.
Essentially, is kinda like field mapping.

Here I made a little mockup for the app showing better what it does: video

I hope I was more explenatory this time around :grin:

Okay, now I understand what you mean.
Let me do some testing and get back to you on it

1 Like

Hello @Pixo,
Thanks for flagging this.

So from my testing, this is using prepared statements.
We have raised a ticket internally for this.


Let me search around to see if there is a workaround you can use

\

thank you very much!

Hello @Pixo,

unfortunately at this time, you won't be able to use SQL Query on JSON because of the prepared statements bug

But you can use JS as a workaround

Attached is a demo app
PixoDemo.json

Thank you very much! I'll try this workaround as soon as I can