@select-list
Update the SQL query dynamically from a dropdown list in the ChartSQL Studio UI
Last updated
Update the SQL query dynamically from a dropdown list in the ChartSQL Studio UI
Last updated
List
A list of values to use in the select list options that will transform the SQL query based on the selected option.
@select-list allows you to define a custom drop down selection that can be used as a variable within the query. This is useful when you have chart data that you want to change at the query level, including complex dynamic SQL.
@select-list allows you to create customizable reports using a single base query that the user can then select within the UI. @select-list allows you to consolidate certain queries which are very similar.
The value of the select list is never null, therefore your SQL query does not need to handle the empty case. The first element in the @select-list is the default value.
If you want to simulate any/null/none, have your first select value be a value like 'none' or 'any' and handle this yourself in code.
The templating language that processes the dynamic SQL is Handlebars.js. This allows for basic control flow (if/then/else), loops and equality checks.
The following variables are provided to the SQL script Handlebars processor that you can use in your handlebars logic.