Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

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

Tool or macro to process one file then loop back and process the next file in a directory

aamerin
7 - Meteor

Hello all,

 

At work I have to process a particular form over and over again (think, same form submitted by a different person each time). To make my job more efficient, I'm wanting to process the forms through Alteryx (forms are saved in a folder on my computer--about 50 forms).

 

I've figured out the workflow for processing the forms, however, the issue is that it is currently only set up to process one form at a time. This would mean that if I have 50 files, I'd have to put a new file in the input tool 50 times. There's got to be another way! I also don't want to combine all the forms first and then process through the workflow, because each form needs to append to a particular cell value that can only be found in it's unique form submission.

 

Therefore, what I am needing is to find a way to have a directory for my files, have Alteryx process one file through the workflow at a time, then loop back to the directory and process the next file until all files have been processed. I also need the results to be unioned together. 

 

Here is the alteryx package and a sample form. Any help is appreciated!

2 REPLIES 2
BenMoss
ACE Emeritus
ACE Emeritus

You have two options. If the form is identical in structure then you can simply use a wildcard input.

So before if I have my input set to 'c:/ben/desktop/forma.csv'

 

Then I could replace 'forma' with *, this will then try and union all csvs' within that folder together.

An alternative option is a batch macro which you can configure to do all the data prep for each file one after another.

You would have an input that was say a list of the filepaths required. Within the batch macro you would have a dynamic input tool to bring the file in and process any downstream transformation tasks before using a macro output which will then automatically union each loop together.

https://help.alteryx.com/9.5/BatchMacro.htm

Ben


aamerin
7 - Meteor

Thanks for the response! Since I needed the tool process each file separately, I couldn't use the wildcard function. I ended up finding a very old article that walks through setting up a simple batch macro (https://inspiringingenuity.net/2014/02/12/alteryx-simple-batch-macros/) and that format was exactly what I needed in order to process one at a time.

Capture.PNG

The one problem with the example above was that it was saving each out put individually to my computer (I wanted a unioned final result). I then took your advice and inserted a macro output--it turned out exactly how I needed!

Capture2.PNG

 Now, my final question is, "Is there a way to spur a prompt at the end of the process that asks the user if they want to save the results?" I saw a "File Browse" Interface tool and I'm wondering if that's what I should use and how it works.

Labels
Top Solution Authors