Iterative Macro
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
name | subname | newdate | olddate | olddateend |
tom | bill | 1/1/2012 | 1/1/2012 | 12/31/9999 |
bill | john | 1/1/2012 | 1/1/2012 | 1/1/2012 |
john | mike | 1/1/2012 | 1/1/2012 | 1/1/2012 |
mike | cal | 1/1/2012 | 1/1/2007 | 1/1/2012 |
cal | aaron | 1/1/2007 | 1/1/2007 | 1/1/2012 |
3. Outputs two rows as follows:
recentname | subname | newdate | olddate | olddateend |
tom | tom | 1/1/2012 | 1/1/2012 | 12/31/9999 |
tom | cal | 1/1/2007 | 1/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!
Solved! Go to Solution.
- Labels:
- Iterative Macro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I also want to add that the stop condition would be when the olddate <= 2008-08-01. Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@rheepa my pleasure.!!
