We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Iterating through files

Biswarun
8 - Asteroid

I have a folder containing a variety of files. According to business requirements, I need to run a particular workflow (quite easy) on all csv files in the folder. I am assured that they will be of the same type. Further, my output filename shall be a function of the original file name and they need to be slotted into a folder-hierarchy, based on date of running the workflow.

 

So my overall workflow (image attached) goes as:

 

(1) Run directory tool for *.csv.

(2) Sample the top 1 row.

(3) Feed to dynamic input

(4) And, run the individual data-processing workflow.

(5) From the result of (2), use formula tool to get new file name, folder name, and path. Run python tool to create the folder.

(6) Append result of (5) with result of (4), remove extraneous metadata columns except for path, and write to output (by replacing file path) using path column.

(7) Provided a successful output (block tool), move the processed file to a separate directory using python tool.

 

 

I am wondering about how to loop my overall workflow infinitely until Step (1) returns no row. Probably, iterative macro is the way to go about this but I am a total noob in it. Will appreciate some help.

6 REPLIES 6
Qiu
21 - Polaris
21 - Polaris

@Biswarun 
Sounds like you will need a batch macro.

Use the unique file path as Control parameter, and put your workflow inside the macro.

Capture6A.PNG

Biswarun
8 - Asteroid

@Qiu 

Thanks, I redesigned my workflow. Now, a few queries:

(1) Will my macro (.yxmc) have any input in it? Or shall it start with the data cleaning steps and the input be taken from the workflow (.yxmd) that calls the macro?

(2) How to "Use the unique file path as Control parameter"?

Emmanuel_G
13 - Pulsar

Hi @Biswarun ,

 

I did a test with an iterative macro. You will find a test in PJ.

 

Is it something like that you want?

 

Emmanuel_G_0-1658398332280.png  

Emmanuel_G_1-1658398377951.png

 

      

Qiu
21 - Polaris
21 - Polaris

@Emmanuel_G 
Thank you for providing the greate sample.

Emmanuel_G
13 - Pulsar

@Qiu With pleasure 🙂

Idyllic_Data_Geek
8 - Asteroid

Hello, I've a similar use. I'm reading bunch of text input files. I want to feed them one by one into my logic . How can I accomplish it?

Labels
Top Solution Authors