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
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??
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')
My solution works with any file name. Please check that.
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
Please mark as solved if it solves the issue.
Hey @APIUserOpsGiri,
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.
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?).