The Basic Report Conversion Process
First, we might as well be up-front: the basic process of converting Dynamics NAV classic reports to RDLC layouts is clunky, time-consuming, and somewhat error-prone. This is caused in large part because you have to repeatedly work back and forth between the NAV classic report designer and the Visual Studio report designer (if you don’t understand why, see Converting Dynamics NAV Classic Reports To RDLC – Part 1).
The best way to demonstrate this is with a walk-through of the simplest possible report: a two-column (Code and Name) list of salespeople that looks like this in the classic Print Preview:
The report has no true header or footer, no global variables or C/AL code, no hidden fields – no complications whatsoever. It also has no RDLC layout, meaning it can only be run in the NAV classic client.
To create an RDLC layout, you have to first open the report in the classic report designer. NAV then provides us with two menu options:
- View->Layout; or
- Tools->Create Layout Suggestion.
If you choose View->Layout, NAV will either open the report’s existing RDLC layout, if one exists, or create a new blank RDLC layout.
If you choose Tools->Create Layout Suggestion, NAV will attempt to create a new RDLC layout based on the report’s classic layout, overwriting the existing RDLC layout, if any (though it will first request your permission to do so).
In either case, NAV will launch the Visual Studio Report Designer and load the RDCL layout in effect. For now, choose option # 2, the Create Layout Suggestion, which should result in the following Visual Studio Report Designer screen:
Naturally, the first thing you’ll want to check is how the report looks with its new RDLC layout, but here you run into your first challenge: there’s no way to preview the report from this environment. What you have to do instead is:
- Click File->Save Report.rdlc in the Visual Studio Report Designer.
- Switch back to the data items form of the classic report designer.
- Click the data items form, giving it focus (that’s the trigger for the next step in the process).
NAV will then respond with the following form:
Click “Yes” to this question.
What are you answering “yes” to? You’re loading the RDLC layout saved in the Visual Studio Report Designer into the classic report object.
Loading is not the same as saving and compiling, however, so if you want to properly complete the process, you will have to click File->Save in the NAV classic report designer and make sure the “Compiled” box is checked.
Where’s your RDLC report preview? Still not there yet. To this point, all we’ve done is ensure that the RDLC layout we saved in Visual Studio is the same as the one we’ve saved in the NAV report object, i.e. we’ve put them in sync.
With your report properly saved, you have to type the following at the Windows command prompt: “DynamicsNAV:////runreport?report=XXXXX”, where you replace “XXXXX” with your report ID. Note, this form of the command is dependent on the availability of a local service tier. If you’re missing said tier, you’ll have to run a more specific form of the command, as follows: DynamicsNAV://server/service/company/runreport?report=XXXXX, where you replace the bolded elements with your NAV server name, service, and company, in addition to providing the correct report ID.
Do all this correctly and you will be rewarded with the RDLC Report Viewer preview of your report, as follows:
Now picture doing this for every review cycle (i.e. every time you want to preview a change you’ve made to an RDLC report), and you’ll understand why we refer to the process as “clunky”. It’s not as bad as it seems, mind you. After a while, your fingers get pretty quick at such repetitive tasks, but that, of course, can cause other problems…
Beware the Gotchas
There’s a reason we just dragged you through the preceding process loop, and it’s not because we’re sadists. Look again at the steps involved:
- Open report in classic report designer.
- View or create an RDLC layout and load it into the Visual Studio Report Designer.
- Perform layout work in Visual Studio. When you’re finished, save the Report.rdlc file.
- Switch back to the classic client, click on the data items form.
- NAV will ask you if you want to load the changes made to the RDLC layout. Say yes.
- Click File->Save to save and compile the report.
- Use the Windows run command to launch a preview of the updated RDLC version of the report (you can alternatively provide access to a report by putting it in a menu on a page in the RTC, but that won’t do much to shorten the process).
Now consider for a moment what will happen if you make changes during Step 3 of the process, save these changes in Visual Studio, then make some more changes, then switch back to the classic report designer without saving your second set of changes. NAV will still inform you that the RDLC layout was changed by Visual Studio. You will no doubt proceed to save and compile the report. But when you run a preview of the report, it will not render the report based on your latest version in Visual Studio. It will render it based on the version you last saved in Visual Studio, i.e. excluding any changes you made after that point (which may well be more your fault than NAV’s, but keep in mind the messages give you no clue; in fact, they go a long way to reassure you that all is well).
This may seem like a small issue, and indeed NAV will prompt you to close and save your layout in Visual Studio when you attempt to close the classic report, but if you’re new to the Visual Studio Report Designer and need to go through a lot of change/review loops during development, this type of gotcha can seriously mess up your debugging process.
So the moral of this post is: be careful in this environment, because it’s not only clunky – it’s a bit tricky, too.
In the next post, we’ll undertake our first conversion of an existing NAV classic report into its RDLC counterpart, and begin showing you some of the problems you’ll encounter, as well as how to fix those problems.