Start Free Trial

Alteryx Designer Desktop Discussions

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

Get sql query run at execution time?

bsharbo
11 - Bolide

Hello everyone. I am running a sql query against a database that I am dynamically altering the where clause of...  The query has 8 hard-coded where clause values that all change depending on user input.  The query is being dynamically altered using Control Paramaters and Action tools.

 

Based upon this fact, is there a way to output the ACTUAL query that was produced during a particular run of a given workflow?

 

For example: If my query is hard-coded as below.

 

select * from persons where personName="Brandon" and Age>20 and income<50000

 

However a user selects the name "Brandon" from a dropdown, and the age from a dropdown, and a text box enter for the Income...   I aslo gave them an option to return "ALL" for each category. Based upon these inptus the query could change to ANY of the following....

 

select * from persons where personName="Patricia" and Age>15 and income<70000

select * from persons where Age>20 and income<70000

 

select * from persons where income>100000

 

I am confident I know how to make the code do what I want, but am getting to some queries where I am alterying 9-10 where clause selections, and would just like to be able to do some QC on my checks.  It seems like being able to write the actual query produced to a text file would help my testing purposes.

 

Thanks and let me know if anyone has any questions.

 

 

 

2 REPLIES 2
jdunkerley79
ACE Emeritus
ACE Emeritus

One suggestion is to use a formula tool to form the query.

 

You can then use a message tool to log the query with the additional clauses.

 

Then pass it into a dynamic input tool and set it to replace the entire query.

 

 

bsharbo
11 - Bolide

Ah that perfectly solves my problem thank you!

Labels
Top Solution Authors