Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Dynamic Input from user

temp
5 - Atom

Hi,

I need to update my sql query based on the user input from the list box.

Example: List box has options A,B,C,D,E,F,G

When user selects A, B then In the SQL query it should filter in the where clause in (A,B) and based on the user selections this where clause should change dynamically.

3 REPLIES 3
Raj
14 - Magnetar

@temp 


Create a List Box Interface Tool: Add a List Box tool to your workflow. Configure it to display options A, B, C, D, E, F, G, and set it to allow multiple selections.

Read your SQL Data: Use an Input tool to read the data you want to filter using the SQL query.

Generate Dynamic SQL Query:

Connect the List Box tool to a "Formula" tool.

In the Formula tool, create a new field that dynamically generates the WHERE clause based on the user selections. You can use a formula like this:
"IF [ListBoxField] = "A" THEN "A" ELSEIF [ListBoxField] = "B" THEN "B" ELSEIF [ListBoxField] = "C" THEN "C" ... ENDIF"

4.Filter Data: Connect the Formula tool to a "Filter" tool. Use the dynamically generated WHERE clause field as the condition in the Filter tool.

5.Output the Filtered Data: Connect the Filter tool to an Output tool to save or further process the filtered data.

temp
5 - Atom

But its difficult to write the formula for all possible combinations

temp
5 - Atom

Can anyone help me with the workflow.

Labels