To pick up previous day file using a macro use the following syntax:
previous day: &[yy]&[mm]&[dd.-1d]
Previous month: &[yy]&[mm.-1m]&[dd]
Previous year: &[yy.-1y]&[mm]&[dd]
However when the month changes, the syntax should be &[yy]&[mm.-1m]&[dd.-1d]
When the year changes, the syntax should be &[yy.-1y]&[mm.-1m]&[dd.-1d]
I suggest you copy the input file to a folder, and use a wild card character, e.g OTD.DRAFT.TAPE*
What would be really great here would be an option to work with the current date, as one can in Monarch for example, and specify a number of days, months, years, or whatever to change it by. Then convert the result to the format used to select the report.
Any possibility of proposing that to the developers?
I guess it could be scripted or processed separately (based on a User input field at run time?) and the result brought in somehow but so much easier if it could be applied directly.
If it is safe to assume that all of the reports in the folder with name the same other than the date part are consistent for processing by this routine (I am assuming you may have several reports here in some situations but realise you might just be needing a formula that picks up "yesterday's" file for processing today) .... then you also have the option of processing every file and filtering the results.
If you need to allow for, perhaps, deferred processing because reports are not presented each day of a weekend,say, or systems have been taken out of action for maintenance or some other example, then running a mass process once for a black of reports and filtering the results for output may be a good approach anyway. It would also provide for easy recovery in the event that something goes wrong with the process somewhere and the auto run fails or the distribution fails (email system down for example) and re-running would be the simplest way to resolve things.
Just a few thoughts to add to possibilities.
I agree with Grant and the previous date macro can be enhanced.
I find another solution that you can try,
Create a Standard project in the Automator and add three input files as listed below (change path)::
' covers input file within each month
' covers input file that has the month end date and the current date is first day of the new month
' covers input file that has last date of last month of the previous year and the current date is first date of the first month of the new year
Set the File existence criteria option to 'not required'
Create a Standard process, either schedule it or monitor for the OTD.DRAFT.TAPE* input file name. The process should be able to fins at least a file that meets the above macros.
The only think is, if there is only one file is in the folder, and input distribution is configured, the process runs successfully with distribution error, but no process failed alert will be generated.
I use the yesterday's date macro for most of my processes in Automator as we need the end of day file for yesterday. The macro is what you have above but with a period in before the "-d", not sure if you have that in Automator or that just wasn't typed here.