Alteryx Designer Desktop Discussions

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

Date Macro Filter

AlteryxUserFL
11 - Bolide

I created a workflow to review the last 8 days worth of a data set. The filter (below) pulls in 8 days of data and then the rest of the flow checks to see if any changes have happened to the data based on the minimum date available:

 

 

[Date] >= ToDate(DateTimeAdd(DateTimeToday(), -8, "days"))

 

 

This process works great, but now I need to run the process iteratively for the past couple months, is there anyway to create a macro so that I can pull in chunks of 8 days worth of data at a time. The rest of the flow will be easy to modify, i'm just not sure how to setup a macro to pull in 8 days of data at a time based on a start date, say Jan 1 2020.  

5 REPLIES 5
Jonathan-Sherman
15 - Aurora
15 - Aurora

Sounds as though you need to convert it to a batch macro. You'll need to add a control parameter, connect that up to your filter (to the thunderbolt icon) will create an action tool, and just replace the DateTimeToday() string. The control parameter will create another input anchor on your macro. Use this to feed in a list (text input) of dates you wish to filter for and your macro will run once for each line in your text input tool.

 

https://help.alteryx.com/2018.2/BatchMacro.htm

AlteryxUserFL
11 - Bolide

Thank you for the info, I read the link and converted the flow to a batch macro. Do you have any examples of how I could setup a batch macro to pull in 8 days worth of data at a time. 

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @AlteryxUserFL,

 

Of course!

 

I've attached an example workflow.

 

So i started with an example input:

 

image.png

 

The macro itself looks like the below, and in essence is filtering for where the date is greater than or equal to a certain date (defined by the control parameter) and also adding in a new column with the date defined by the control parameter so we know which run the record came from.

 

image.png

 

The output of running this batch macro with two values in the control parameter input of 2020-01-05 and 2020-01-02 would be:

 

image.png

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.

 

Regards,

Jonathan

AlteryxUserFL
11 - Bolide

Thank you, the example was wonderful. I was able to update the workflow, but I keep getting an error. I have attached my workflow with a small amount of fake sample data. Any help would be awesome. 

Error.PNG

AlteryxUserFL
11 - Bolide

I fixed the above issue by changing the control grouping. 

 

Fix.PNG

Labels