Alteryx Designer Desktop Discussions

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

Only pull through files from last month in directory

cayladuplooy
7 - Meteor

Hi,

 

I run a report at the beginning of the month. I need all files from the previous month to flow into Alteryx. How can I do this? I have tried using the directory tool but can't seem to get it to work.

 

Thank you

4 REPLIES 4
Luke_C
17 - Castor

Hi @cayladuplooy 

 

A directory tool is probably a good first step. After loading the directory, you could do a filter on one of the various date fields loaded by the directory. For files created on or after the 1st of the previous month, the below filter would do the trick. It subtracts 1 month from today's date, and the datetimetrim sets it to the 1st of the month. 

 

Can you say more about the files? If they're all the same schema you could then use a dynamic input or batch macro to load them into the workflow.

 

[CreationTime] >= datetimetrim(datetimeadd(datetimetoday(),-1,'month'),'firstofmonth')

Luke_C_0-1642038312840.png

 

 

 

cayladuplooy
7 - Meteor

The issue with using the dynamic input is that the file used as the input data source template will always need to be from the date period we are looking at e.g. if we are looking at jan 2022 files then the source template needs a creation date in jan 2022.

 

The files are all in CSV format and have the same columns so should be the same schema.

 

Thank you

Luke_C
17 - Castor

@cayladuplooy then a simple batch macro should do the trick. There are some great resources on the community if you're unfamiliar 

Luke_C
17 - Castor

One other thing thay comes to mind: if the filenames themselves have a date in them, you can read in all of the csvs with 1 input tool using a wildcard (\*.csv). Include the filename as a field and parse out the date to filter down what you need.

Labels