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 / Iterative Function Help

Shockwave
5 - Atom

Hello Everyone,

 

I am currently working on an iterative macro to try and automate a process, but I have hit a roadblock. Currently, the workflow that I have put together is able to take in a number of data records, and then convert those records into a JSON payload which is then used with our API to automatically push data into a third-party website. Unfortunately, the functions for converting the records into a JSON payload only write out one line. We cannot do this process when there is more than one group at a time, since each group have their own URL on the website. This process works great for when we are only dealing with one group, but if we are dealing with multiple groups then the process is no longer suitable as we would have to copy out the functions for every group that we are dealing with. 

 

Accordingly, we are now trying to create an iterative macro that can handle our data. This macro needs to be able to push our data through "X" number of times, with "X" being equal to the amount of unique values in Column A (Group ID). 

 

I have attached an excel file below to give an idea of the data that we are handling. Thank you for your time, and I would greatly appreciate any kind of assistance in solving this issue. 

4 REPLIES 4
T_Willins
14 - Magnetar
14 - Magnetar

Hi @Shockwave,

 

Instead of an iterative macro, could you use a batch macro?  Group by field group ID and use that for Control Parameter.  Inside the batch macro filter the inbound data (your Excel sheet) by the group ID and attach the Action tool to the filter to change the filter on each batch.

Shockwave
5 - Atom

Hi @T_Willins,

 

Thank you so much for your time. I did consider a Batch Macro, but from my understanding I think an Iterative Macro would be more appropriate since its more dynamic. From what I've read a Batch Macro is better for when we know the number of iterations that our Macro must run, while an Iterative Macro will keep running as long as there are records. 

 

 

----

 

Also, I just realized that the file I attached in the OP had a few errors, so I am attaching a corrected version. 

T_Willins
14 - Magnetar
14 - Magnetar

Hi @Shockwave,

 

The opposite is true.  An iterative macro is set with an iteration limit, while a batch macro will run until it has processed each batch entered through the Control Parameter.  

 

In the attached workflow I mocked up your data batching to an Excel workbook with each group ID writing to a separate worksheet in the workbook to show how a batch macro would work with your data.

 

Batch Macro3 Workflow.png

 

Batch Macro3.png

 

 

 

Shockwave
5 - Atom

Hi @T_Willins,

 

You are correct! The batch macro was definitely the way to go, and not the iterative macro as I originally thought. Thank you so much for taking the time to help me work through this issue, I greatly appreciate it. 

Labels