Alteryx Designer Desktop Discussions

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

Dynamic folder reference - different files from single folder

Sebastianroling
5 - Atom

Hi, I am trying to understand how to make the foldername, and only the foldername, in a filepath dynamic.

 

I am building a workflow that each month reads a number of different input files from a single folder and summarizes these into a single output file in the same folder. The filenames are the same very month, but the folder name changes, eg:

 

Month 1 - Jan

Read:

C:\MyFolders\Jan_2023\File1

C:\MyFolders\Jan_2023\File2

C:\MyFolders\Jan_2023\File3

Write:

C:\MyFolders\Jan_2023\OutputFile1

 

Month 2 - Feb

Read:

C:\MyFolders\Feb_2023\File1

C:\MyFolders\Feb_2023\File2

C:\MyFolders\Feb_2023\File3

Write:

C:\MyFolders\Feb_2023\OutputFile1

 

What I want to be able to replace dynamically each month is the month name [Jan_2023, Feb_2023] only - the filenames should remain unchanged. I tried the File Browse tool, but this requires updating the full file name (I believe), so would not help. 

4 REPLIES 4
Clifford_Coon
11 - Bolide

Hi @Sebastianroling 

 

I'd use a Date input tool and use DateTimeFormat([Rpt_Date],"%b_%Y")  to format to MON_YYYY.

 

 

The action would be update with formula:   replace([Destination],"JAN_2023",DateTimeFormat([#1],"%b_%Y"))

 

 

Happy Solving :-)

 

 

Sebastianroling
5 - Atom

Hi,

 

thanks very much for the note back. The part where I am struggling: how do I run this as a single action (updating the folder reference) on the multiple Input Data and Output Data tools in the workflow?

 

Sebastian

Yoshiro_Fujimori
15 - Aurora

Hi @Sebastianroling ,

 

Though I am not fully sure what you need, as a starting point, here is a solution with Apps.

You select the folder where the input files are stored, and the output file will be output to the same folder.

 

Workflow

Yoshiro_Fujimori_0-1684241903000.png\

Apps UI

Yoshiro_Fujimori_1-1684242016330.png

 

If necessary, you can add some aggregation process or any other transformation after Dynamic Input tool.

Good luck.

Christina_H
14 - Magnetar

Are your three files input through a single tool, or through three separate tools?  The basic solution is the same, use a formula to generate the correct month format, but you'll either want to use a directory tool to find all the files and then filter to the month, or have three separate text inputs with e.g. the January filepaths and replace Jan_2023 with the correct month.  This will give you the new filenames you want and you can run them through a dynamic input tool(s) to pull in the data.

Christina_H_0-1684244728739.png

Labels