Alteryx Designer Desktop Discussions

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

How do I wildcard for today's date

Brad1
11 - Bolide

 want the file that has today's date on it.   Example:

 

abcd_20171013

adcd_20171012

 

I want to import the first file.

 

thanks!

7 REPLIES 7
NicoleJohnson
ACE Emeritus
ACE Emeritus

You'll want to use a formula like the following:

 

"abcd_"+ToString(DateTimeFormat(DateTimeToday(),"%Y%m%d"))

 

This will put today's date in 20171013 format, convert it to string, then add it to whatever your base file name is called. If you're using this file as an input, you can feed this file name into a Dynamic Input tool to bring in that specific file. By adding the full file path to the "abcd_" text, you'll be able to choose the option in Dynamic Input to replace full filepath with this field to always bring in the current day's file.

 

Hope that helps! 

 

NJ

Brad1
11 - Bolide

Ok, thanks.  I'll see if I can figure out what that means and try it.  Basically, I don't care what is to the left of the date as far as file name goes.  Was thinking that could be wild carded out.  The date will be at the far right.  That, I need to catch as today's date and import it.  The path will always be the same and the file name to the left of the date could probably always be the same if I made sure of that before running the workflow.  I've never used that tool.  I was thinking this could all be placed in the file name with wild card formula in the Input tool file name field.  Thanks for your help.

Brad1
11 - Bolide

I guess I don't understand why it couldn't be:  "C:\adcd"+ToString(DateTimeFormat(DateTimeToday(),"%Y%m%d"))   in the file name in the Input tool.  I'll try and figure it out tomorrow.  Frustrating.  Thanks again.

SophiaF
Alteryx
Alteryx

If you are using a Directory tool (or even if you just have a straight list of the file names/file paths) you could use a Filter tool with a custom expression:

 

 

Right([filename], 8) = datetimeformat(datetimetoday(),'%Y%m%d') 

GO2nia7

 

You might need some additional logic if your filename/path contains the file extension:

 

Right([filename], 13) = datetimeformat(datetimetoday(),'%Y%m%d') +'.xlsx'

Either way I think the Dynamic Input tool is the way to go!

Sophia Fraticelli
Senior Solutions Architect
Alteryx, Inc.
PoojaSingh88
7 - Meteor

The filter custom doesnot work for me ,,, 

 

i have four files region_20190617, region_20190618,region_20190619,region_20190620. When I try 

Right([filename], 13) = datetimeformat(datetimetoday(),'%Y%m%d') +'.xlsx' it filter all as false.

 

but when i try 

Right([filename], 13) = '20190618.xlsx' it filter correctly as true.

what am i missing .

LukeM
Moderator
Moderator

@PoojaSingh88 - have you tried to use a formula tool and the expression to make sure it's producing what you expect?

PoojaSingh88
7 - Meteor

I was able to correct the formula, capital [FileName] worked.However when i tr to pass that into a dynamic input i get an error - Unable to open file for read ...Error opening File.access is denied 

Labels