With the Document Creator developer license also comes the Classic Report Converter module. The converter enables us to convert classic reports to modern Document Creator (DCR) reports. The new DCR 3.0 ships with a completely rebuilt classic report parser, which allows us to convert better and more accurate than before. In this blog we will take a look at how to convert classic reports and how the converter translates NAV code.

Split between dataset and layout

First a little background info on DCR architecture. DCR respects the modern paradigm of separating the data, logic and presentation. The dataset is the NAV report object that collects data for your report, while repecting all the business logic and security settings. In classic reports pre and post triggers are found directly within the layout which. These triggers allow modification of data during the rendering process. With DCR the layout is separated from the dataset. Therefore, end-users or consultants can edit the layout without being able to harm the dataset or business logic. Furthermore, the layout does not connect directly to the database, but gets the data from the dataset (i.e. the report object output). One can now modify layouts without modifying NAV objects, because the layout has become data. This is great news because in a managed environment, object modifications require administration and therefore raise costs. With Document Creator everyone can alter layouts without any risk.

Dynamics NAV Report Converter - split between data and layout

Report Converter

Where converting classic to modern reports usually is a time consuming process. Document Creator does all this in just a few easy steps (clicks). Let me just walk you through that process with a few screenshots. To use the converter you must have a NAV developer license since the automated conversion process imports objects as txt files.

First export your classic reports as xml files by using the classic development environment. In this case 5 we select reports to export.


File | Export | Save as type: XML

Then open NAV 2015/2016 and navigate to Document Creator/Classic Report Converter


Select “Import Classic Report” and select de xml file you just have created. All 5 reports are added. Now we have to give them a new unique Report ID and Name.

Note: if you have many reports to process you can go to Actions | Renumber and Rename to automatically generate new object id’s and report names.


In our case we do it manually by adding 50 in front of the ID and NEW behind the name.

Now we select all the reports we want to convert and click “Convert Classic Report”. This gives us the following result:


The first 4 reports are convert without any errors. Let’s have a look at Report 50205. Click “Edit Layout (with data)”, the designer is opened and click Preview to show the result:


This looks quite the same! (Except for the font because it is converted from Helvetica to Arial.)

Note: We can set font conversion options on the following page: Departments/Document Creator/Document Creator Setup/Classic Report Font Conversion Setup

Back to the conversion page. The last report has conversion errors. The conversion process has a few stages, and if a step is succeeded the checkbox will be checked. You can always restart the conversion and the converter will then start with the first step that is still unchecked.

The following stages apply:
•New Report (BLOB) – New Report Object is created and stored in a BLOB field.
•New Report Exists – New Report is exported and imported successfully into the database.
•New Report Compiled – New Report successfully compiled.
•New Layout (BLOB) – New Report Layout is created and stored in a BLOB field.
•New Layout Exists – New Custom Report Layout for the new report is created.

Click on the red Yes label in the column that indicates that there is an error.


To fix this error we have to go to the report object. Click “Edit Dataset” and press F11. The Required Filter Field “Bill of Materials” does not exists anymore in the Item table. Remove the Required Filter Field and compile again, now everything compiles well.


Close the object and save changes.

Go back to the Conversion Page and click “Convert Classic Report”. The conversion is now completed!


A closer look

In this chapter we will take a closer look at how everything is converted. In the conversion list page select report 50205 and click on “Edit Dataset”. The data items are the same as in NAV 2009.


Open de C/AL code Sales Header – OnAfterGetRecord:


Code is never deleted but will be commented with a “DCR:” tag. Here we see the example of the dimension code conversion. In NAV 2015/2016 dimensions work with a Dimension Set ID. The converter will convert this code for you.


Because of the split between data and layout, the layout has no knowledge of the data that is gathered, it only gets the result set of the data gathering process. Totalfields has become obsolete in NAV. The converter will create variables and summary data items to implement the same behavior. Take a look at the VATCounter example.


The OnPreSection code is translated to a local function which is used in de dataset:



Eventually all above options are used in the designer to produce the same output as the original reports.


Besides what we have now demonstrated, there are many more smart conversions on elements like groups and totals. We see that the DCR development team is really committed to continuously optimize and improve the converter, so that in the end no user code modifications are required.


The main goal of Document Creator is to provide a user friendly and time saving report designer. Also the converter is a real time saver! As with most IT systems and processes, with converting NAV reports its also ‘Garbage in, Garbage out’. So although the classic report converter does a great job, one still has to consider rebuilding those reports that were developed on really bad-practices. We all know they exist. Previous NAV versions simply allowed way too much rubbish and spaghetti. If you want to build reports from scratch, DCR provides us with a good set of template layouts, shipped with the installation package. You can use them as a starting point. Building your layouts this way, makes that you get future proof reports which are optimized for speed. Even when working with the converter as much as possible, I still advise everyone to build a few reports from scratch, just to get a better understanding of the whole DCR system!

Source: This blog was posted on LinkedIn by Koos Splinter