Alteryx Designer Desktop Discussions

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

How to get yesterday's date in a Formula tool

RoelEsselink
8 - Asteroid

Hello all,

 

I am trying to create a workflow that will send an attachment by email every day. The filename changes reflecting yesterdays date in the filename. So the report send today would have this file name: Report_2015_12_22.csv (also note the underscores being used in the date)

 

I am using a Text Input tool to get the name of the attachment and then using a Formula tool to replace the date part in the attachment field. If the file name was using today's I would have already fixed it using this formula: 'C:\Apps\' + 'Report_' + Replace(DateTimeToday(),"-","_") + '.csv'

The output is C:\Apps\Report_2015_12_23.csv.

 

However to get yesterday's date in and replace the hyphens with underscores I am stuck and cannot get it to work.

 

I've attached a sample workflow and report.

 

Does anyone know how to accomplish this?


Thanks in advance!

Roel

 

edit: changed extension used

2 REPLIES 2
RoelEsselink
8 - Asteroid

Colleague helped me out already:

 

'C:\Apps\' + 'Report_' + DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,"days"), "%Y_%m_%d") + '.csv'

marlline
8 - Asteroid

This is so helpful when I tried to figure out why number age group changes comparing with yesterday's number.

Thank you so much!!


@RoelEsselink wrote:

Colleague helped me out already:

 

'C:\Apps\' + 'Report_' + DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,"days"), "%Y_%m_%d") + '.csv'


 

Labels