Beginners question: is it possible to create SQL Statements for Queries dynamically

Hallo all

We just evaluating RETOOL for a Query Building System.
Therefore we want to set a system where a user can click his resultset together eg
[] is GDPR Complient
[] has subscribed
[] last order older that [] day

Setting up the Frontend is very simple, and using variables to add then in the WHERE clause of the query, too :slight_smile:

In our case there will be about 100 questions and in most case these are not just variables, but will include SQL Subqueries.

Setting this up for 5 - 10 is fine, but by adding more and more this get very complicated and buggy

So our idea is to store the WHERE clause at the question and creating the hugh SQL by ANDing all selected questions.

So is this possible to do with RETOOL, and if so - can you give some tips how to proceed

Best regards

Peter from Vienna (AT)

Hey @peter.ireds!

You might try using a JSON Schema Form to create the list of checkboxes you're looking for. On submission, you can then access the form's data property and build your query by looping through that to build your query. How complex the JavaScript or JSON Schema needs to be would depend on how complex the queries can get. Would almost every query structure need to be recursive or would your subqueries be relatively simple?