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.
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 :-)
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
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
\
Apps UI
If necessary, you can add some aggregation process or any other transformation after Dynamic Input tool.
Good luck.
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.