We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

Alteryx Designer Discussions

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

Use Filter Tool to filter files ending with suffix date

Giridharan
7 - Meteor

I'm trying to use Filter Tool to filter out the files that end with a suffix as today's date. I need a formula that does that

 

For example if today's date is 28th November, 2002 I want to filter out the files that have names like filename_2022-11-28.csv 

 

 

9 REPLIES 9
Felipe_Ribeir0
15 - Aurora

Hi @Giridharan 

 

You can use this formula

[filename] = 'filename_'+ datetimetoday() + '.csv'

 

Felipe_Ribeir0_0-1669667847775.png

 

gabrielvilella
14 - Magnetar

Here is one way you can do this.

DateTimeToday() = ToDate(REGEX_Replace([FileName], '.+(\d{4}-\d{2}-\d{2}).+', '$1'))
binuacs
17 - Castor

@Giridharan One way of doing this

 

binuacs_0-1669672482255.png

 

Giridharan
7 - Meteor

I gave file name as an example but my filename is different every time.. like it can be filename_abc_2022-11-26 or filename_dfgf_2022-11-26?

Can you help work a formula that starts with any suffix but ends with today's date?? 

Felipe_Ribeir0
15 - Aurora

Hi @Giridharan 

 

If the name is different but you have at the beginning of the name 'filename' and at the end 2022-11-29.csv (today.csv), you can use this formula

 

REGEX_Match([filename], 'filename' + '(.*)' + datetimetoday() + '.csv')

 

Felipe_Ribeir0_0-1669736175894.png

 

gabrielvilella
14 - Magnetar

My solution works with any file name. Please check that. 

DenisZ
11 - Bolide

Hi @Giridharan 

 

By using DateTimeToday() it would search the whole path for the date, no matter if you have anything in front or behind. A solution would we as follows

 

DenisZ_0-1669793312232.png

Please mark as solved if it solves the issue.

Adrian_T
Alteryx
Alteryx

Hey @Giridharan,

 

I believe the solutions provided by @gabrielvilella@binuacs and @DenisZ should work just fine for you. The key here is to use the DateTimeToday formula to achieve dynamism in your formula such that Alteryx always looks up for today's date when running the filter.

 

Here is a helpful list of DateTime functions in Alteryx.

Felipe_Ribeir0
15 - Aurora

I would consider using a more restricted solution using not just the date, but more parts of the filename. This can avoid a lot of errors if someone puts by mistake any non related files on the folder that have the date as part of the name too (most of them have/should have, right?).

Labels