Hello,
I am trying to create an App which queries from a database, and takes multiple inputs using the Text Box and Action tools. But, I don't always want the query using all of the action tools..I want some of them to be optional.
For example, I would like to possibly only enter the Div ID (see attached), leave the other fields blank, and have the query just execute on div id. Is this possible?
Solved! Go to Solution.
In a macro (should work for your app) you could use a nested if statement and a single action tool utilizing the 'update value with fomula' function. You would have the action update the SQL statement.
Something like:
IF [Div ID] > '' AND [Model Request ID] > '' AND [Model ID] > '' AND [Selection Request ID] > '' AND [Campaign ID] > '' THEN " 'Div ID = '[Div ID] +' AND '+ 'Model Request ID = '+[Model Request ID]+' AND 'Model ID = '+[Model ID]+' AND '+'Selection Request ID = '+[Selection Request ID]+' AND '+'Campaign ID = '+[Campaign ID]" ELSE
IF
ISEMPTY([Div ID]) AND [Model Request ID] > '' AND [Model ID] > '' AND [Selection Request ID] > '' AND [Campaign ID] > '' THEN "'Model Request ID = '+[Model Request ID]+' AND 'Model ID = '+[Model ID]+' AND '+'Selection Request ID = '+[Selection Request ID]+' AND '+'Campaign ID = '+[Campaign ID]" ELSE
etc..
One if statement for every possible selection.
Hopefully someone will chime in with a cleaner way to do it.
Hi @ckestler,
You can nest the interface tools under a checkbox or radio button as such:
Tick the option on the Checkbox/Radio Button for 'Collapse Group when Deselected' and use the up/Down arrows in the interface designer to nest the options inside the selectable options.
Kane
OK, a little late to the party. Was Googling for a different problem and this appeared in the results. Anyway...,
A good technique is to create your base SQL statement and have a where 1= 1 clause. After that, just append as many "and this = that" clauses that your users choose. Example:
Base_SQL = "select greeting1, greeting2 from salutations where 1 = 1"
Then you can append "and greeting1 = 'hello'" and/or "and greeting2 = 'world'" depending on if your user filled in either one or both.
I know in the Dynamic Input tool you can replace the whole SQL statement, so build up your SQL with the additions to the where clause and run with it.
User | Count |
---|---|
18 | |
14 | |
13 | |
9 | |
8 |