We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Dynamic SQL Query Selection

VijayGopal
6 - Meteoroid

Hi Team,

 

I'm currently developing a use case that involves executing multiple SQL queries, each with varying WHERE conditions. These conditions are dynamic and subject to frequent updates. I'm seeking a solution that allows users to choose any condition, input values for the WHERE clause, and execute the query. Examples are provided below, and any assistance would be greatly appreciated.


SELECT * FROM Employees WHERE Department = 'Sales';
SELECT * FROM Employees WHERE Department = 'Sales' AND Salary > 50000;
SELECT * FROM Employees WHERE Department = 'Sales' OR Department = 'Marketing';
SELECT * FROM Employees WHERE Department IN ('Sales', 'Marketing', 'HR');
SELECT * FROM Employees WHERE Salary BETWEEN 40000 AND 60000;
SELECT * FROM Employees WHERE HireDate > '2023-01-01';

1 REPLY 1
KGT
13 - Pulsar

For executing, the Dynamic Input tool will be easiest I would think. You can store these in a file as NAME:VALUE like such:

AlteryxGui_9k3e728hSK.png
 
Note: sorry about the brevity below. I typed out more, but then the pictures failed on upload and I lost everything below, so here's the retyped abridged version.
 
Then set up the workflow like such:
AlteryxGui_eDZYysBCF3.png
This may take a little bit of work to match your exact use case and how many options you want.
 
You WILL NOT get the interface tools to change based on the selection in another Interface tool. They will all configure at the same time, however you can nest options under radio buttons and set it up as such:
AlteryxGui_oTrfiq74LG.png
Labels
Top Solution Authors