Hi,
I had a query in one of my projects wherein I was supposed to name the file dynamically, for eg: if today's 10th April then the filename must be "[FileName] 10 Apr, 2021" (Basically, it works on a T-2 logic). I was successful in creating a logic for this, but the problem arrives every Monday because my formula works on a blanket T-2 basis, it considers Sat & Sun as working days so when my workflow names the file created for Monday, for example, 12th April, then it gives "[FileName] 10 Apr, 2021", ideally it should have been "[FileName] 08 Apr, 2021" (which is a Thursday).
Moreover, I faced similar problems when there was a UK holiday because my formula also included UK holidays as working days.
Can it be possible to rename my file dynamically on T-2 basis which excludes Weekends and UK Holidays as working days?
My Formula : '[FileName] ' + ToString(DateTimeFormat(DateTimeAdd(DateTimeToday(), -2, 'days'), '%d b, %Y'))
Solved! Go to Solution.
*UK Holidays is optional*
Hi @sanketkatoch05 - Here is what you can try: [FileName] + ToString(DateTimeFormat(DateTimeAdd(DateTimeToday(), switch(DateTimeFormat(DateTimeToday(),'%a'), -2, 'Mon',-3, 'Tue',-4), 'days'), '%d %b, %Y'))
I'm not sure whether this formula would give Thursday's date for Monday. I guess I need to replace -3 with -4. Can you guide me?
Basically, what I'm looking for is I should be shown last week's Thursday's date on Monday and last week's Friday's date on Tuesday on the File Name.
Hi @sanketkatoch05 - Yes, just replace -3 with -4. Switch is basically if-then-else multiple times. In my formula default value is - 2, if 'Sun' then...
Hope it's clear now.
Thank you so much @ArtApa, I understood the concept now very well.
There's one last query if I have a set of dates in a separate file(excel) which basically has the holidays mentioned(date format) of a calendar year and I want Alteryx to use this data to rename the working file(mentioned above) according to these dates as well, i.e, considering today's date as 15 April and in the holiday list I have 14th April marked as a holiday. Since Alteryx is renaming the file on a T-2 basis, will it be possible for Alteryx to skip 14th April while doing T-2?
For example, 15th April file should be named as <[FileName]+'12th Apr, 2021'>.
The same should be done on other dates as well. Also, when there is a holiday on Friday, it should perform T-5 instead of T-4.