Schedule a report to run everyday with that day's date
aseigle
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?
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?
0
Best Answer
-
Had a read of the post you mentioned and I couldn't get it to work for filters on the DataItems (it stored both the text and date values) but it did work based on my 2nd post - except you don't have to parse/evaluate yourself - it's all done by the client. Here's what you do...
1) Create a Text variable to hold your date filter expression
2) Add it to the Request page
3) In the OnPreDataItem trigger add code to apply the filter e.g.SETFILTER("Date Filter",MyDateFilter);You can now enter complex filter expressions and it evaluates perfectly, I tried something a bit silly to test... e.g. TODAY..%CM%|WORKDATE..%+1M%
As the filter expression is evaluated at the time it is run it will update as required.6
Answers
-
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 :-/ ...-rico19310
-
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.0
-
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.0
-
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-stuff0 -
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.0 -
Had a read of the post you mentioned and I couldn't get it to work for filters on the DataItems (it stored both the text and date values) but it did work based on my 2nd post - except you don't have to parse/evaluate yourself - it's all done by the client. Here's what you do...
1) Create a Text variable to hold your date filter expression
2) Add it to the Request page
3) In the OnPreDataItem trigger add code to apply the filter e.g.SETFILTER("Date Filter",MyDateFilter);You can now enter complex filter expressions and it evaluates perfectly, I tried something a bit silly to test... e.g. TODAY..%CM%|WORKDATE..%+1M%
As the filter expression is evaluated at the time it is run it will update as required.6
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions