ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Alteryx Designer Discussions

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

Repeating a workflow a variable number of times/looping

7 - Meteor



i've done some searching through the forums, but I think what I think I'm using the wrong words or the concept is a little nebulous because I don't think I've seen anything that matches closely what I'm trying to do. 


I have 2 tables.  Both are manufacturing bill of materials.  Table A is a component.  Table B is all components and the associated top level materials. 


Just joining table A to B to return the results:  no problem.  There's a bunch more i have to do after the point, but not a big deal. 


The catch is, there's intermediary results between A and B.  These can be effectively passed through, where joining A->B results in an intermediary material, requery with B with the intermediary result, returning the next result.  The catch is that this cycle could happen a bunch of times and I really have no way of knowing how many times in advance. 


I've written batch macros before.  It sort of fits here, that I could just write a batch macro, drop it on the page 10 times and cross my fingers, but I'd really like to find out how I can best do with this Alteryx. 



17 - Castor
17 - Castor

It sounds like you've got a case for an Iterative Macro. An iterative macro will run a workflow over and over until either the workflow conditions are met (and no records pass to the loop output), or the max iterations is met (set in macro properties). 


If you have some sample data/workflows to share, I'm sure the Community can help get you started.

17 - Castor
17 - Castor

Hi @danloz 


Check out Weekly Challenge #81 Multilevel Bill of Materials.  This is very similar to your problem and you'll be able to find lots of solutions.  Just don't look at my solution.  I was still new to the Alteryx thing and didn't know to include the macro in the package I submitted.  I'll have to fix that some day.  


Edit: Fixed now. I wasn't able to edit the original post since 524 days had elapsed(go figure), so I added a new one.



7 - Meteor



Thanks so much for pointing me in the right direction.  I have a......'limited' version of the iterative macro running and I'll work on adding some special sauce later.