By Filip Gudelj, Microsoft Business Solution Manager, Recro-Net

Microsoft Dynamics NAV useres commonly ask for the ability to start classic reports from the Microsoft Dynamics NAV role-tailored client (RTC). But the design of the RTC client itself does not provide an easy way of calling these reports via GUI integration with specific business processes of end user.  So to deliver on this customer request you have to do a little customization to expose these reports. In this article I'll show two little tricks for calling classic reports without need of further thinking what data you're actually trying to show.

Dummy Game

The idea behind the "Dummy Game" is a simple trick of setting one dummy data set as the first record set of a report. Basically this dummy data set will act as the data provider bookmark from the RTC client - or it will copy data from an RTC client row into the report field as parameter.

In this example I'll use my custom report "Vendor balance"which will be called directly from the Vendor Card Page. We developed it as a NAV classic report and put it on the vendor card. The problem with this report was that it was still behaving like a classic NAV report despite advanced functionality of calling it directly from a vendor record. And the user needed to enter vendor data from the vendor card from where it was called - a double job.  So here's the dummy secret.

In first data set of the report we've placed the Dummy Data item.

Dummy Data Report Microsoft Dynamics NAV RTC

The role of this dummy filter was to filter data of page that it was called from and set the filter for the report Record Set data. All of C/AL code is inserted into OnPreReport() trigger.

Microsoft Dynamics NAV RTC Report Dummy Data Code

And that did the trick.

But while using this Dummy Game trick we noticed one additional misleading error which could be misleading for the end user: the UI directs the user to enter data into report request form even though it is not needed. The data transferred from RTC on to the classic report with this Dummy Game is not shown in report fields. In this example we transferred Vendor VAT No. And it was not shown on the request form of the report, but it was there because when we you start the report it really shows the record set of the bookmarked vendor. So the best approach is to remove this field from the request form.

Also there is another catch to this. Classic reports are designed (in true Dynamics NAV spirit) to accept as many as parameters or values in the request form fields as possible. In this case, when using the Dummy Game, you can call reports for only one record, or better said, for the bookmarked record.

So my recommendation is to really think if you want to use the Dummy Game or not. In the end it depends on the client's business processes and business requirements.

Page Record Filtering - Bookmarking

Another way of calling reports from RTC is with record filtering, or setting a bookmark on the page itself. Unlike the Dummy Game where all the "trick" code is customized on report itself, here we are setting filters directly on the page.

The trick in this classic report call is to set a filter on an action, which is calling the report.  But no report customization is needed. A specific action is used for calling the report C/AL code that has been inserted into the OnAction() trigger.

Microsoft Dynamics NAV RTC Report page record filtering

This code runs through all of the records visible on the page and remembers the one that you've bookmarked. This trick may be better than the Dummy Game approach in the sense that it cannot mislead end users and it shows all bookmark data in request form fields.

The only drawback of this method is that the user can see how RTC is running code on page and highlighting every row as it passes through. In this method the user can also edit values in request forms and insert values as he pleases.

And in conclusion, before using any of these methods, it is best to consider all pros and cons of using filtering. I share these methods based on my perspective of upgrading classic NAV to RTC, where the user already has the experience, knowledge and routine of using classic reports. And when implementing classic reports for a new NAV RTC user I would always go for one of these methods to avoid exposing the new user to the obligatory parameter entry of classic reports that is inconsistent with RTC.