I am looking to use a drop down variable with options different than the where clause.
For example, I'd like to have 1 Month and 1 Year as an option but the variable used in the where clause would be 30 and 365. This is a simple example, but there are many times I want a human readable option for a drop down to have predefined choices, but the query uses something more technical.
Is there anyway to have more flexibility with how variables are used than simple template replacement?
select *
from orders
where date > getutcdate() - 30
On the UI, I'd want to have the variable period, but instead of 30 and 365, I want to display "Week", "Month", "Year". This is a very simple example.
There are lots of scenarios I want to have a where clause in a drop down of selectable choices, but the choices are not human friendly.
Another scenario, I want to do a query with multiple variables but there is only one where clause, and depending on which variable is populated, determines which where clause is used. Using the [] syntax to have it only show up if there a variable is populated works fine for a single variable, but when there are multiple it doesn't work.
Basically want more freedom to use variables & drop downs less literally in the SQL statement. Does this help explain it?