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.
SOLVED

Iterative Macro

rheepa
7 - Meteor

Hi Alteryx Community,

 

I'm having trouble getting started on an Iterative Macro that accomplishes the following:

 

1. Pass in a name: "tom"

 

2. Loops through a data set like below:

 

namesubnamenewdateolddateolddateend
tombill1/1/20121/1/201212/31/9999
billjohn1/1/20121/1/20121/1/2012
johnmike1/1/20121/1/20121/1/2012
mikecal1/1/20121/1/20071/1/2012
calaaron1/1/20071/1/20071/1/2012

 

3. Outputs two rows as follows:

 

recentnamesubnamenewdateolddateolddateend
tomtom1/1/20121/1/201212/31/9999
tomcal1/1/20071/1/2007

1/1/2012

 

So, let's say someone changes their name between certain dates and I need to link all of their historical name changes. If they change their name more than once in a day, I ignore it. All names are unique and I ultimately want to pass in a list of names. Can someone help me get started? This would REALLY help me out.

 

Thank you so much!

 

5 REPLIES 5
rheepa
7 - Meteor

I also want to add that the stop condition would be when the olddate <= 2008-08-01. Thanks again!

Amol_Telore
11 - Bolide

Hey @rheepa 

 

I hope this is what you are looking for.

 

I have created iteration macro which will iterate over the data to get a list of all name changes and then that iteration macro is encapsulated in batch macro just to run in batches for each name to iterate the data properly. Then the unnecessary records have been removed from the flow. Also if name change record was happened before 2008-01-01 then it will not be considered.

 

Amol_Telore_0-1657899159531.png

 

Amol_Telore
11 - Bolide

FYI, Batch macro was indeed necessary as you have mentioned there will be multiple user names to iterate through data. If there was only one user then only iterate macro would have sufficed. 

rheepa
7 - Meteor

Can I give 100 Likes? This was an amazing solution. I adjusted it to fit my requirements but the fundamental logic from your example was key. Thank you so much!!!

Amol_Telore
11 - Bolide

@rheepa my pleasure.!!

Labels