Is there a way to dynamically name the output file upon completion of running a report from scheduler?
I would like to add the current date to the end of the file name.
Thanks. Rich
8 comments
-
Jet Reports Historic Posts I think this has been discussed before, but I can't really find it.
The best way I can think of is, since Jet makes a windows schedule, you can schedule a batch file behind it to rename/move the file. In that you can add a couple of parameters (ex date). -
Jet Reports Historic Posts You can use the current date and time.
in the output location as either a File Name or Folder
use
%DAY% - 2 Digits
%MONTH% - 2 Digits
%YEAR% - 4 Digits
%HOUR% - 2 Digits
%MINUTE% - 2 Digits
it uses the date/time at the end of the report.
for a report ran on 12 August 2009
C:\%YEAR%\%MONTH%\Test %DAY%.xls
will save to
C:\2009\08\Test 12.xls
also if a report starts at 11:50 PM and runs to 12:10 AM the next morning
the date values will be for 12:10 not 23:50
-Bromy -
Chris Berry Is it possible to generate the previous value? i.e. %MONTH% -1 or %MONTH-1%
-
Harry Lewis Hello Chris -
The Autopilot Command Line Substitutions work with the current date and time. So, while you are definitely able to design a report that presents data for a particular point in the past, any file name using the substitutions would be based on when the report actually completes.
-
Heather Rowe I have done this with tweaking the "Output' parameter of the Batch Report provided in the report templates some time ago (and hopefully still available)
-
Harry Lewis That's great, Heather!
Yes, a link to the Batch File Template is available in the article for How to Use the Jet Professional Scheduler.
-
Chris Berry Thanks!
I was mainly looking to be able to run a monthly report for the previous month and output the file name with the previous month instead of the current month. Heather's solution looks like it might take some tweaking, but would work. I was just hoping that I could change the current %MONTH% to the previous %(MONTH-1)% as that would have been a little easier, but that's alright. Thanks for the response. -
Heather Rowe I agree - that probably would have been an easier method if it were available. But, I've been using the Batch File in the scheduler, even for a "batch" of a single report for so long now, that I really like being able to tweak the file name. So personally, even if that were available, I don't see myself using it.
I have some batches that add the customer name to the file name (not just an account number), or if the report is on a particular department within the customer it includes both of those items. If I change the account/department combination, the new report is named appropriately. Other reports include a product category code in the name of the report.