Alteryx Designer Desktop Discussions

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

Run multiple SQL queries on Alteryx by changing the dates in the query

Madhusudhan
Átomo

Hi All,

 

I have some 10 different queries to extract data from SQL DB and need to change the dates in the query everyday I run. please help me how to configure them on Alteryx as I do not want to put 10 different input files and keep changing them everyday. I highly appreciate the help.

2 RESPUESTAS 2
apathetichell
Pólux

set up your query in a text input - THIS HAS TO BE IN ONE ROW. USE SUMMARIZE IN /n to get it there if you need to.

 

use a second input to have a date variable. append text input 2 to text input 1.

 

use a formula tool - and create the name of your database connection In-DB in a field. (ie "Snowflake")

 

Add a dynamic input in-db. Map your connections. create your in-db logic for each query. if you are brining on canvas use datastream out. connect a macro output tool to our data stream out. use interface designer to configure all iterations to union by name.

 

add a control parameter.

attach an action tool to text in put 2. configure it to replace the date in text input 2.

 

save this as a batch macro.

 

in another workflow create a list of your dates.  Add your batch macro to your canvas.

map your dates in your new workflow to your contorl parameter field in your batch macro.

 

you have now created an in-db batch macro which will run separate queries for your 10 different dates.

Swathi
Asteroide

What you can do is declare date Values in the SQL code to use parameter and pass them from the Control Parameter. 

Etiquetas