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.

workflow need to run each sub directory and save output on each sub folder

Dhilip_Kumar
8 - Asteroid

Hi All,

 

I want to run my workflow in each sub folders and save output file on respective folder then move to next subfolder. I have attached my workflow and input files. Please do the needful.

 

 

Thanks

Dhilip

2 REPLIES 2
BrandonB
Alteryx
Alteryx

Hi @Dhilip_Kumar 

 

Your workflow is set up to load an individual file, so rather than being set up as an analytic app, this is best suited to run as a macro which feeds in a folder location. 

 

From what I can tell in your workflow, it looks like your workflow just reads in a file, filters down to Product Type A, and then outputs a new file called Sales Data.xlsx.  The most efficient way to do this, assuming schemas of all files are the same, is to use a Directory Tool on the top layer folder and checking the box to also look for subfolders. This will pull every file in every folder under the top level folder. Then you can follow this with a Formula tool where you use the File Path from the Directory tool for all of the files and add on |||Sheet1$ so that you have the file and sheet designated. Then pass this resulting column through a Dynamic Input tool which will stack all of the data. Make sure that in the template in the Dynamic Input tool that you also choose the option to use file name as field so you have it as something you can reference. Now that you have a complete data set, you can run all of your data through a filter tool where Product Type = A. The resulting data set will be only records that meet this criteria. Now, following this filter, you can use another formula tool to dynamically create the desired file path also using the file path field that exists in your data as part of your formula. Then you can use an Output Data tool where you check the box for "Take File/Table Name From Field" down at the bottom and choose the option to Change Entire File Path and select the new column you created with the desired naming convention.

Dhilip_Kumar
8 - Asteroid

@BrandonB  Thank you for your suggestion on this. But I just upload the sample file and testing workflow to understand the concept easily, my workflow had 12 containers and each containers had minimum 10 tools. Data also very sensitive so I would not merge all the data into one sheet if any one row change then it will impact very huge so I want to run the Alteryx workflow each subfolders separately without merge another file data.

Please advice me and Once again Big thank you for your suggestion.

Labels
Top Solution Authors