community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Gather all 9 clues to complete the final Weekly Challenge on Dec 16!

Learn More

(Iterative?) macro that processes one file at a time

Meteor

I have created a workflow that is very delicate and needs to process one file at a time regardless of schema in order to avoid errors. I have created a directory of my input files and have a formula set up to ensure that once a file is processed it moves on to the next one (just by removing prefix from output file and then removing where they duplicate and selecting first of the remaining files). The processing time is not lengthy but it is a pain to have to keep pressing "Run" every time rather than looping back and going again if I have a very large number of files.

 

This seems likely to be very solvable but haven't managed to find a solution through the search.

 

Thanks in advance for your help!

Comet

You've probably tried this already, but if you have a list of the filenames of all the files you need to process, you can feed that into your macro using a control parameter (attached to an action that updates the filename). This will run your macro as a "batch macro", so it will run the macro for each record in the input you feed into the control parameter. Without knowing any more about your specific use case it's hard to say anything more specific. One trick I've found for getting around schema issues is to just attach a record id and transpose using that as the key so that, regardless of file, the schema you feed in/out of your macro is just "record id, name, value".

 

 

Meteor

Actually I have not tried that and I am very unfamiliar with how macros work and how to construct them. Could you provide a simple example of what you mean? 

Bolide

There are many good recorded training videos for batch macros and iterative macros.

 

Search this page for "macro":

https://community.alteryx.com/t5/Live-Training/Live-Training-Index-amp-Welcome/m-p/45161/thread-id/4...

 

 

Meteor

I have not found them very helpful as I believe they are slightly outdated and I am not sure which type of macro I want to build.

Comet

You might find the attached macro useful.....I built it while trying to figure out a similar problem. Basically, how it works is the individual filenames in the workflow are fed into the macro using a control parameter tool, which is attached to an action that updates the filename for a file input tool. The batch macro will run through once for each input fed into the control parameter, and union the results for output. In this case all the batch macro does after input is pivot the data to maintain the same schema for outputs, but you could do other computations inside the macro.

Meteor

Thank you Ada, that's helpful.

Labels