Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Passing one Date_ID at a time from a range

Gelly
7 - Meteor

Hello! 

I am new to macro and I have a huge processing using batch macro that runs for 1 day at a time.  (Batch macro = 1 day processing)

I want the same macro to run for 2 months and automate this run with another macro or a dynamic process. 

 

What is the best way to make it dynamic and run it for 2 months without manually changing the Date_IDs?

 

For example: 

I provide a Start_Date_ID = 7000  and End_Date_ID = 7060. I used the 'Generate Rows' tool to generate all the dates in between from 7000, 7001, 7002.....7059, 7060. 

 

I want to iterate row by row. 

First run - the macro passes 7000 and runs the Batch macro = 1 day processing- stores the data in Alteryx.

automatically pick the next row 7001 and run the Batch macro = 1 day processing- stores the data in Alteryx.

and continue till date_ID 7060. and finally compile all the results. 

 

What would be the best way to achieve passing 1 DATE_ID at a time from a range and stop the processing at the END_DATE_ID?  Is there a way to pass the difference between END_DATE_ID and START_DATE_ID (Which can change over time) and make the process run as many times as the difference?  (I could not make iterative macro work 😣 )

 

I would appreciate any suggestions. Thanks! 

8 REPLIES 8
terry10
12 - Quasar

Sounds like you will want to use an iterative macro. Check out the weekly challenges to learn how to build iterative macros.

Qiu
21 - Polaris
21 - Polaris

@Gelly 

Did you try the Batch macro insidea batch macro?

KGT
11 - Bolide

So you want the process to run once each day for 2 months, and then collate all the results, with the processing time being a day.

 

To control this from a workflow, then you would need a workflow running non-stop for 2 months. That is super risky, as any combination of things could happen over that time that disrupt the workflow. It could be as simple as someone opening a file that the workflow is trying to use. Let alone company IT shutdowns etc.

 

You could schedule the Batch Macro in a workflow to kick off each day using the top entry in a list, with the workflow removing that top entry during processing (Or use the date to pick the right row DateTimeDiff(DateTimeToday(),[StartDate],'day') will give you the number of days since start and then that can be related to a recordID on the list.)

 

If you don't have Server, then the above won't work, though the methods should still help.

Gelly
7 - Meteor

@KGT Thanks for your response!

 

I have historical data saved in cloud and I have a huge macro which runs the query for reach day. 

Now my use case is to look at say the past 2 months (which is on cloud storage anyway). 

 

I was just wondering if there is any way where I can make Alteryx automatically pass a single Date_ID in my other huge macro and do it for the entire 2 months - one by one. I would be providing the start and end date_ID correctly. 

 

I have Alteryx gallery scheduling for ongoing future result  but my use case needs to access the historical data - 2 months (variable)

Gelly
7 - Meteor

I tried to use RecordID and created a sequence and pick the first record and run the batch macro. 

I can add the same macro multiple times with the help of a filter and do it...

But it is a repeat process. So I was wondering if there is a smarter and efficient way to do it. 

I am trying to understand how too make iterative macro work.

Gelly
7 - Meteor

Yes. That's what my conclusion is so far  based community solutions. 

Iterative macro is lil tricky to understand. I will check the weekly challenges to understand how to make it work. Thanks!

KGT
11 - Bolide

OK, so it seems I read too much into your text, the macro does not take a day to process and the process shouldn't run for 2 months, rather just over 2 months worth of data.

 

When you pass the list to the batch macro as a control parameter, Alteryx will cycle through the list... That's precisely what they are for. If you have a different control parameter on the macro (and don't want to work out how to use 2), then you may want to wrap it in another macro, both iterative and batch will work for this.

Gelly
7 - Meteor

Sorry for the confusion. I made it work using python in Alteryx with a 'for loop'. 

I will try and learn more about control parameter and iterative macro in future. Thank you! 

Labels