Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Dynamic input to Directory tool

sbatra116
8 - Asteroid

problem:

read files and subfiles from a folder. BUT don;t hardcode the values in Directory tool

 

Issue:

Folder & file name/path will be stored in spreadsheet

Folder PathFile Name
C:\Alteryx\testCompany*.xls
C:\Alteryx\testbank.csv

 

get folder,file name --> input this to Directory tool --> read data --> process --> repeat for the second line

 

Output:

data from all the files together for each row

row 1 - output 1

row 2 - output 2

 

if the input data has 10 rows then 10 output files.

but if input data has 1 row then  only 1 output file.

 

5 REPLIES 5
IraWatt
17 - Castor
17 - Castor

@sbatra116 I think I understand what you want and it sounds like an iterative macro. At what point do you want to stop looping through directories? Is it just the file structure your after or do you want every file to be mashed into one? Do you need to read every sheet in each excel file?

sbatra116
8 - Asteroid

@IraWatt

 

Mash all the files together for each row -- this will be output 

row 1 - output 1

row 2 - output 2

 

if the input data has 10 rows then 10 output files.

but if input data has 1 row then  only 1 output file.

 

-- Updating the original post with this -- 

IraWatt
17 - Castor
17 - Castor

A batch macro would let you pass a bunch of values to a directory tool:

IraWatt_1-1654102277672.png

And then update and output the results of each:

IraWatt_0-1654102205736.png

And if you tick add sub directories you would get every file included within that directory with it:

IraWatt_2-1654102320889.png

 

 

sbatra116
8 - Asteroid

IraWatt

 

I tried similar.  NOT WORKING

below macro screenshot asks me to set directory (which i don;t want to) as this will come as input.

another issue: how to pass the second parameter required for directory tool ?

 

sbatra116_0-1654103721016.png

 

Workflow screenshot

sbatra116_0-1654103898602.png

 

 

IraWatt
17 - Castor
17 - Castor

Hey @sbatra116  the community has some great videos on macros Interactive Lessons - Alteryx Community essentially batch macros will loop through each row and apply the logic. So when it says set the directory tool it just means it will dynamically change the value from the values you give it. 

Labels