Alteryx Designer Discussions

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

Force all results from batch macro to union in order

I have a batch macro that uses grouping to have different data sets go into the macro. I have a set order of those groups going into the control parameter connection, so in theory the batch macro should process batch number 1 first, then batch 2, and so on. I'd like the results of each run to be unioned in the order that they are (ostensibly) being created, but that doesn't seem to be the case. So either the batch macro doesn't in fact process the groups in the order that the identifiers go into the control parameter or it doesn't write them out in the order that they are created. 


Any suggestions on how to do this?


Essentially what's happening:



7 - Meteor

Hi Alexandra, 


Wny not use Engine.IterationNumber constant available in a batch macro? This number can ensure you collate the output in order. 




Add a formula just before your Macro Output



Hope the above suggestion helps. 




18 - Pollux
18 - Pollux

Hi @Alexandra_Mannerings 


The easy answer is to sort them outside of the macro.  The more satisfying answer involves looking into the macro and examining its behaviour.  Can you post the main workflow and the macro here?



Unfortunately, it turns out that for whatever reason, the batch macro does NOT process the groups in the order that they are listed in the Control Parameter input stream. I don't know if this unique to this batch macro or if this is expected for all batch macros? So unfortunately, the Iteration number doesn't help. 


To solve this problem, I ended up adding a RecordID tool and a Formula field that contained the Control Parameter field so that I could do the sort after the macro finished running.