With the release of Dynamics NAV 2013 R2, the Classic report designer was discontinued, as was the whole NAV Classic Client. With each NAV version upgrade, custom objects (which includes reports) requires a special upgrade path.
Dynamics NAV 2009 versions (SP1 and R2) allow for storing both Classic and RDLC report layouts depending on which Client the user prefers to work with. Dynamics NAV 2013 and later allow only for the RDLC report layout. This means that in the course of upgrading reports from versions earlier than NAV 2009 to the version NAV 2013 or later, we need to use the Dynamics NAV 2009 version as an intermediary in order to bring our report to the new upgraded version.
In this demo, we are going to learn how to create a report upgrade path from Dynamics NAV 5.0 version to Dynamics NAV 2013 R2 version. We will use Dynamics NAV 2009 R2 as the intermediate version for our work.
First of all, let’s create a simple custom report. We will not use a standard NAV report as it already has a corresponding upgraded version in the target database. Open Dynamics NAV 5.0 and click Tools, Object Designer. Select Report object type and click New to create a new report. We will create a simple report to list posted sales invoices:
Click OK. Add the following fields to the right-side pane and click Next:
Click Next twice. In the wizard page which asks if you would like to group your data, click No, and then click Next. Select the Amount field to create totals for the fields:
Click next and on the last wizard page, select List report type. Then click Finish.
Click View, C/AL Globals and add the global variable AmtToShow of Decimal type. Next, add the SwitchAmt boolean variable. Close the Globals window.
Click View, Request Form. Click View, Toolbox and add a checkbox control with a label to the request form:
Select the checkbox control and open its properties. Assign the SourceExpr property to SwitchAmt.
Select the label and assign the Caption property to Show VAT Amounts. Close the request form.
In the report designer, select the Sales Invoice data item and press F9 to open the code. Enter the following code on the OnAfterGetRecord trigger:
Close the code editor, click View, Sections. In the sections, set the following textbox SourceExpr properties:
On the Sales Invoice Header data item, click SHIFT+F4 to open its properties. Set the following property:
Save the report, e.g. with ID 50000 and name it “Sales Invoices – List”. Close the report.
Now we are ready to transform the report:
In the Object Designer, select the report that we’ve created in step 1 and click File, Export. Save the file as 50000.FOB.
Open the Dynamics NAV 2009 R2 Classic Client, open the Object Designer and click File, Import. Import the file we created in step 2. Click Yes on the confirmation message to import.
Now we are going to transform the request form into a request page using the Transformation Tool provided with the Dynamics NAV 2009 R2 installation package.
Select the report in the Object Designer and export it as XML to the destination where your Transformation Tool folder is. In our case this is:
C:\Users\Forza\Desktop\Microsoft Dynamics NAV\TransformationTool
The file name should be Forms.xml. Replace the file if necessary. Next, in the Transformation Tool folder, run the Microsoft.Dynamics.Nav.Tools.FormTransformation.exe file. The output command window will run the script and close automatically:
The tool creates a new file called Pages.xml which we are going to import into Dynamics NAV 2009 R2. In the Object Designer, import the Pages.xml file located in the Transformation Tool folder.
Select the imported report and click F11 to compile it.
Once the report is compiled, we can create the RDLC layout. Select the report, click Design, then click Tools > Create Layout Suggestion. The Visual Studio designer is open with the suggested layout. Since our report is simple, we will agree to the suggested layout. Close and save the report.
Now, export the report from the Object Designer as .FOBt file.
We now need to import this report into NAV 2013 first to upgrade its structure.
Open a Dynamics NAV 2013 Development Environment and import the report. Click OK on the confirmation message. Next, click Tools, Upgrade Reports. Click OK on the confirmation message. Next, select the report, and click Tools, Upgrade Reports:
Click Yes on the confirmation message. The report is upgraded to the new structure. Press F11 to compile the report.
Now we are ready to export the report as a .FOB file. Do so and close Dynamics NAV 2013.
Open Dynamics NAV 2013 R2 Development Environment and import the report. Click Yes on the confirmation message.
The report is now upgraded to the NAV 2013 R2 version and can be run from the new environment. The following will be shown.
The request page:
The transformed report:
As we see, the report upgrade path requires many steps, however, they are easy and quick.
Let’s revise the main steps:
- Use Dynamics NAV 2009 versions (SP1 or R2) to upgrade the request form into the request page
- Import and convert the report in the Dynamics NAV 2013 environment
- Import and compile the report in the Dynamics NAV 2013 R2 environment