Free Trial

Alteryx Designer Desktop Discussions

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

Directory Tool

Jaspal80
7 - Meteor

I have a folder where daily files gets saved.

 

the files has different name and format but ends with date in the format YYYYMMDD

 

I want to read files for the current day and the day before - so 20221031 and 20221029

 

In the directly tool under file specification how can I make the date part dynamic to read only the files with these too dates rather than reading all the files?

 

This will be linked to dynamic input tool to link similar files so I will have to create multiple workflow to do this I guess.

 

Thank you for your help.

5 REPLIES 5
DavidSkaife
13 - Pulsar

Hi @Jaspal80 

 

It's not possible to make the Specification section dynamic as far as I'm aware.

 

You can use a wildcard (*) to bring in all and then perform the filtering to just the files you want after the Directory tool.

binuacs
21 - Polaris

@Jaspal80 You can add a filter tool and update to only pick the date you wanted to be like below

 

binuacs_0-1667382034163.png

 

Sebastiaandb
12 - Quasar

Hi @Jaspal80 ,

 

I made two action tools connected to two directory tools. You can union the output of those tools to get only today and yesterday :-).

Sebastiaandb_0-1667382088042.png

 

If you then make batch macro's for each day you probably can do it in one workflow :-)!

 

Greetings,

 

Seb

DataNath
17 - Castor
17 - Castor

Hey @Jaspal80, to tackle this I'd use a filter that gets today's (and therefore yesterday's) date, formats it to match your file names and then checks for their presence within the file names coming through from the Directory tool. You can see here that I have a bunch of files coming in here:

 

DataNath_0-1667382073494.png

 

After applying the filter:

DataNath_1-1667382091606.png

 

The expression I use in the filter is:

 

Contains([FileName], DateTimeFormat(DateTimeToday(),'%Y%m%d'))
OR
Contains([FileName],DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,'day'),'%Y%m%d'))

 

Hope this helps to get you started! You mentioned the files having different formats etc and so you may need a batch macro rather than multiple dynamic inputs. Though this depends on the exact details of your requirement.

grazitti_sapna
17 - Castor

@Jaspal80 Would suggest a similar approach to use custom filter and read only those records which has current date and yesterday's date in it.

 

grazitti_sapna_0-1667382789585.png

 

 

Sapna Gupta
Labels
Top Solution Authors