Schedule a report to run everyday with that day's date

aseigleaseigle Member Posts: 207
I've posted this on Microsoft's Partner forum and never go a response, so I thought I'd try my luck here.

My question is not how to schedule a report, or how to schedule a report to run every day. I understand how to use the Schedule option, and the Job queue to set up a recurrence.

What I want to do is run the Daily Invoicing Report every day, with the current day's date at the date filter. So today is the 11th, to when I run the report today, date filter is 11. When I run it tomorrow, date filter is the 12th. I don't want to have to change the filter everyday. I want/should be able to set up recurrences for a report and then have the report update daily. I know if pages there are functions like %WORKDATE and %TODAY, but they don't appear to work with reports. I can enter it, but once I close the record, it loses the function and is just a standard date. any ideas?

Best Answer

Answers

  • rico1931rico1931 Member Posts: 295
    You'll have to create a report with the parameters and schedule the Job Queue to run that report. We do it to Run our MRP/MPS reports. It gets pretty complicated with some codeunits being called at the same time :-/ ...
    -rico1931
  • KishormKishorm Member Posts: 921
    Not ideal but one option is to add a Tick box option for "Today's Date" and if this is set then it overwrites the standard date filter with today's date - not much code needed for this to work.
  • aseigleaseigle Member Posts: 207
    edited 2017-01-19
    while that would work on reports that run for a specific date, it would break if the report had from/thru dates or a date range. I'm looking for a more global solution.
  • aseigleaseigle Member Posts: 207
    This is what I'm looking for, but I can't seem to recreate it and make it work in NAV 2016.
    https://navug.com/blogs/jason-wilder/2015/04/07/jays-nav-stuff
  • KishormKishorm Member Posts: 921
    My previous suggestion was only for the scenario in the original post. Obviously this concept can be extended e.g. Instead of a check box you could have a text field to store a date formula filter expression so you could enter something like "-CM..CM" which you'd want to evaluate from the 1st of the current month to the end of the current month.

    You'd need a bit more effort here to parse the expression (which could be more complicated) and evaluate date formula expressions to each part of the filter expression but again it's something that Is achievable. And once you've done it once you just put the main code in a codeunit which you can call for any reports that need the functionality.
Sign In or Register to comment.