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

Is it possible to have alteryx read the latest dated file from a folder?

Analyst323
8 - Asteroid

I currently have a schedule that drops a report with a date in the name.

 

The sample file name is transactions_20240311_0 and transactions_20240311_1

I need both files. 

 

I know I can put a * on the input tool but then alteryx will be reading every single file in that folder when I only need the latest two files. 

 

Any suggestions on how to get this to work?

5 REPLIES 5
JosephSerpis
17 - Castor
17 - Castor

Hi @Analyst323 you can see the other methods outlined in this article to search a directory to find the latest file. You may need to use a sample tool to limit the file to the two latest files.

Analyst323
8 - Asteroid

Thank you! I ended up using the directory tool but that does seem like a good resource for other ways to bring in files. 

apathetichell
20 - Arcturus

Hey - so to clarify - a directory tool reads metadata about the files - the input data tool would read the file. You would use the directory tool to parse the filename (using something like  datetimeparse(regex_replace([FullPath],"^.*transactions_(\d{8})_.*$","$1"),"%Y%m%d") to create a date field. you can then sort on that datefield - use the sample tool to extract the top two values - and then feed those into an input data tool in a batch macro. 

Analyst323
8 - Asteroid

Thanks for the suggestion! This is how I did it (without a batch macro):
Solution.PNG

BrandonB
Alteryx
Alteryx

You could actually just throw the whole thing in a filter rather than doing a formula and then a filter. Performance wise should basically be the exact same, just saves you a step. 

 

Just configure your filter (Custom Filter option) to say: Left([CreationTime],10) = DateTimeToday()

Labels
Top Solution Authors