Questions Creating a report to automatically send for prior day and month
I created a simple report that has 2 parameters, Start Date and End Date. I set the default Start Date to "=@Today-1" and the default End Date to "=@Today". I saved it as a template and scheduled it to run every morning. Now, I want to be able to do the exact same thing every month. I tried to check if there was a way to dynamically set the start end end dates depending on the job that I'm running (daily or monthly) but I cannot find a way to set those. I could only find it in the report itself. I could duplicate the report and set the default dates to the previous month, but that seems inefficient. Who know, maybe I later add a report to run for the previous week. So, is there a way to use variables like "@Today" in the automation scheduler or report template?
No, not possible.
Put a checkbox parameter in the report which you tick in the schedule template.
Then in the report criteria, where you apply the Start and End Date filters, enhance the logic to incorporate the checkbox parameter. If the parameter is false, apply your @StartDate & @EndDate logic. If it's true, use a filter based on @Today (ie. the same defaults you applied to the parameters).
Here's an example I did for AR Aging MC:
The filter is just a subset of all the changes I needed to make for this particular report but you should get the idea.
Basically wherever the original @AgeDate appeared, I wrapped it with my formula which overwrites that date with Today's date when the @AgeTodayDate checkbox is checked.
Actually, this worked well. Instead of a checkbox, I created a short list (so that I can expand later) and used a "Switch" statement instead of the "IIf" statement. Thanks for your help.