Alteryx Designer Desktop Discussions

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

Looping through the query by splitting it by date range

vertika
6 - Meteoroid

I have an input SQL tool. As per our database, the query is set to time out after 30 mins, and the data is fairly large.

 

So far, I have been using multiple SQL input tools for the same query, by splitting them by dates so that they all work independently and do not time out-

 

EG - FIRST INPUT TOOL

SELECT * FROM A 

LEFT JOIN B on [condition]

WHERE A.DATE_OPEN>='2020-01-01' AND A.DATE_OPEN <'2020-02-01'

AND B.DATE_APPLIED>='2020-01-01' ----This pulls data for January from table A, and everything after January from Table B

 

SECOND INPUT TOOL

SELECT * FROM A

LEFT JOIN B  on [condition]

WHERE A.DATE_OPEN>='2020-02-01' AND A.DATE_OPEN <'2020-03-01'

AND B.DATE_APPLIED>='2020-02-01' ---This pulls data for  February from table A, and everything after February from Table B

 

As you can see, the query is exactly the same, but my Date Range on the ''DATE_OPEN" field changes. The problem with this is, as the data steadily grows, I have to keep adding input tools for each month. If ever I have to change my main query, I have to change it in every single input tool. Is there a way to achieve this so that it loops through the query with just changing the date range?

 

 

1 REPLY 1
Qiu
21 - Polaris
21 - Polaris

@vertika 
Maybe with a batch macro?

A text Input tool will be the input and the dates will be replaced one by one inside the macro.
Sorry I dont have the resource to test.

 

Qiu_0-1620342716784.png

 

Labels