Free Trial

Alteryx Designer Desktop Discussions

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

Iterative and Batch Macro help

Kaseykreid
6 - Meteoroid

Hi all,

 

I have started to use batch and iterative macro's in my workflow recently to tackle more complex problems. I'm having trouble understanding how to create iterative macro's properly. 

 

Below is the current problem I'm trying to solve. I have an example of the data and a "Notes" column that details what I'm trying to get my iterative macro to do:

 

ProductLead Time (M)Lead Time (D)ROPROQYear MonthInventoryOrder PlacedNotes
Product 1241319153552024_011934YesI want the iterative macro to check if the inventory is below the ROP. If it is, then I want a "Yes" in the Order Placed column.
Product 1241319153552024_02628  
Product 1241319153552024_03-678PO OnboardBased on the Lead Time (M) column, I want "PO Onboard"  to added to the "Order Placed" column.
Product 1241319153552024_04-1984  
Product 1241319153552024_052065YesThen when the order has arrived (based on the Lead Time (D) column,) I need the process to start over. Checking if the Inventory is below the ROP again. If it is, the "Order Placed" is populated with "Yes". 
Product 1241319153552024_06759  
Product 1241319153552024_07-547PO OnboardThe same happens again and continues for each row.  "PO Onboard"  is placed in the "Order Placed" column. 
Product 1241319153552024_08-1853  
Product 1241319153552024_092196Yes 
Product 1241319153552024_10890  
Product 1241319153552024_11-416PO Onboard 
Product 1241319153552024_12-1722  
Product 1241319153552025_012327Yes 
Product 1241319153552025_021021  
Product 1241319153552025_03-285PO Onboard 
Product 1241319153552025_04-1591  
Product 1241319153552025_052458Yes 
Product 1241319153552025_061152  
Product 1241319153552025_07-154PO Onboard 
Product 1241319153552025_08-1460  
Product 1241319153552025_092589Yes 

 

 

For further context, I already have the inventory calculated in a separate batch macro and iterative macro and then the result of  the macros would feed into the above new macro which will apply the new details in the new Order Placed column. I have a batch macro that batches the various products I want to evaluate and then the iterative macro to do the above. I'm just really stuck on building it out properly to get it to do what I detailed above.

 

Any help to point me in the direction would be deeply appreciated. 

 

3 REPLIES 3
rzdodson
12 - Quasar

@Kaseykreid would you happen to have a copy of the original workflow you are working off of? Having a hard time understanding what you are saying with your last context statement.

 

For advice, for iterative macros, I would always lead with a RecordID/Filter tool combo to start your iterative macro. This will allow you to use the RecordID tool's value to test whether it is equal to the iteration number of the macro (or, the number of times we have passed through the macro). 

 

For broader advice on the approach, I would suggest a nested batch and iterative macro setup. First, we'll go through each Product (Product 1, Product 2, etc.) then each line item in that product's records (the iterative macro portion I am referencing). In the iterative macro section, we then start layering in the testing logic you are describing  in your Notes column to get this workflow firing off the way you intend to.

 

Hope this guides you along. Happy to help further once we can take a look at the original workflow. :)

Kaseykreid
6 - Meteoroid

Hi @rzdodson thanks for your response. Attached is the original workflow along with the batch and iterative macros that are producing/correcting the inventory data I want to then apply the above logic to.

 

I'm still learning how iterative macro's work so I appreciate anything the helps solidify my understanding of them.  

 

CoG
14 - Magnetar

Here is a sample workflow that I believe will work for your use case (its not the prettiest, but I believe its functional):

Screenshot.png

Labels
Top Solution Authors