Alteryx Designer

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

Unclear on Iterative Macro output methods

Highlighted
10 - Fireball

Hi,

 

I built an iterative macro today, which works great (and is based on a very helpful post by @AdamR), but I am a bit confused about how the macro returns results based on the Output Mode settings.  If I select "Auto Configure by Name" (which is what Adam had in his example, and which makes logical sense), I only get the first record from each iteration returned in the macro output.  But if I select "All iterations will have the same output schema", I get all of the records returned.

 

macro config.png

 

My macro is set up very similarly to Adam's, so I would expect it to behave the same way.  So just a little confused...I'm happy that I get the results I need, but I'm unhappy that what I would take to be a logical configuration setting doesn't produce the results I would expect. :-) . Any insights would be appreciated.

 

macro workflow.png

Highlighted
ACE Emeritus
ACE Emeritus

Hi @mix_pix,

My understanding is that it's basically a union taking place between all iterations of the loop: each iteration result value gets unioned with the results of all previous iterations.  So, if you understand how "Auto-Configure By Name" (or Position) in the Union tool, the same concept applies here.  In your macro, for whatever reason, it may be that field names are different between iterations.  Things to try: you could also try auto-config by position, if it's always however many columns of basically the same data; or (preferable, I'm thinking) you could put a select tool prior to the output to ensure that you always have the same field name and type going to the output.

Hope that helps!

John

 

Highlighted
10 - Fireball

Hi John,

 

Thanks for the reply.  What is thoroughly weird is that I changed my macro to 'Auto Configure by Name' (the setting I had tried initially), saved it and then re-ran the workflow (changing nothing) and the output worked as I had expected it to originally.  A bit baffling, but it's working as it should, so I guess I'll just chalk it up to gremlins. :-)

Highlighted
5 - Atom

Hi @JohnJPS 


Dragging this one back to the surface.
I'm facing the same issue as mix_pix had. Macro runs successfully but the output I get is the union of the first row only.

Expected: 52 iterations which output ~7k rows in JSON format (JSON_Name | JSON_Value) -> unioned = approx. 360k rows

Actual: 52 iterations unioned = 52 rows as I only get row one per output.

 

I can tell that each iteration is successful, as the first row would otherwise fail & no further iterations output.

 

I've added a select tool to ensure that the only outputs are JSON_Name and JSON_Value, but still no luck. Seems like it might be gremlins, as mix_pix said, but no luck with just saving & reloading it yet.

 

Thanks,
Elyssa

Highlighted
ACE Emeritus
ACE Emeritus

Hi @Elyssa,

Reading through this thread again, the only other thing I might mention is that the macro input and Loop output should be the same. (e.g. if you create a variable in the macro that isn't in the input, you could have an issue)... but frankly I doubt this is the issue 'cause the macro would probably fail its own testing phase... thought I'd mention it anyway: we never really did nail down @mix_pix's issue.

Good luck!

John

Highlighted
5 - Atom

Hi @JohnJPS (and @mix_pix)

I have just managed to resolve this (not that I've tried in the last 4 weeks). 
Not sure on why this worked magically: I added a union tool just before the macro output tool, and it's just worked perfectly.
Even though there's only 1 input into the Union, since the macro is doing multiple iterations, maybe that's why it's needed.

 

Before: It was unioning only the first row of each iteration's output. 

Now: It's unioning all the rows of each iteration's output.

In any case. Happy now!

 

Workflow:
iterative macro.PNG

Labels