Liberty Grove Software Logo
Liberty Grove Software
Dynamics NAV Development | Consulting | Upgrades | Training
Menu 

Converting Dynamics NAV Classic Reports To RDLC – Part 5

Preceding Posts In This Series

In Part 1 of this series of posts, we examined the underlying technologies behind RDLC reporting. In Part 2, we looked at the basic process of converting Dynamics NAV classic reports to an RDLC layout.

In parts 3 & 4, we examined some of the issues you will encounter when you use NAV’s Create Layout Suggestion function to generate an RDLC layout, including horizontal and vertical spacing, the use of dataset fields in RDLC report headers and footers, and controlling conditional output.

We’ll now continue that approach by performing the conversion of a more complex report, the document report 5703 – Transfer Order. This example is important because document reports tend to pose the biggest challenge in converting reports to an RDLC layout.

Reversing Microsoft’s Preparations for the Conversion

First, make a copy of 5703 – Transfer Order. Call it “Transfer Order Test”.

Next, open the test copy in the classic report designer. View the report’s sections and delete any TextBoxes with a yellow font. These include “PageCaption” and “OutputNo” in the PageLoop header, “DimensionLoop1.number” in the DimensionLoop1 body, “NoOfCopies” and “ShowInternalInfo” in the TransferLine header, the unnamed TextBox with a SourceExpr of “Transfer Line”.”Line No.” in the Transfer Line Body, and “DimensionLoop2.number” in the DimensionLoop2 body.

Finally, view the  C/AL code associated with the CopyLoop data item and comment out any code blocks that begin with ‘IF ISSERVICETIER”.

We’ll be recreating all these TextBoxes and reactivating these code blocks later, but they were not part of the original report, i.e. they were created by Microsoft only to support the conversion to RDLC, and we want you to re-discover the need for them.

Test Your Starting Point

To ensure we haven’t messed up anything, run the classic version of both your test report and the original report and compare them. Make sure you request one additional copy of the report on the Options tab, but do NOT check the “Show Internal Information” CheckBox. Navigate to the first transfer order copy, which should look like this:

Microsoft Dynamics NAV 2009 RDL Report Conversion Part 5 Sample 1 Screenshot

As expected, the report is showing the contents of one transfer order per page, followed by a copy of that transfer order, and so on through the record set. Creating multiple copies (and marking them as such) is one of the features we’ll have to implement in RDLC post-conversion.

Create Layout Suggestion Results

Now run the Tools->Create Layout Suggestion function from your test report to produce your initial RDLC layout (in this case, because your test report still contains a copy of the RDLC layout from the original report, you will  have to agree to overwrite that layout). Save and compile the report, then run the new RDLC version from the Windows run command (if you don’t know how to do this, see Converting Dynamics NAV Classic Reports To RDLC – Part 2). Again, on the Options tab of the Request Page, make sure you request one copy but leave the “Show Internal Information” CheckBox unchecked.

The initial RDLC report should appear as follows:

Microsoft Dynamics NAV 2009 RDL Report Conversion Part 5 Sample 2 Screenshot

 Right away, we can see that:

  1. The top right line indicates you are looking at a copy, but in fact you are looking at the first page of your report, i.e. you haven’t navigated to a copy yet. Furthermore, you will discover that there are no more pages to the report. You only have one page, and it is marked as a copy.
  2. The word “Page” is missing from the next line down.
  3. There are no column headings.
  4. Two sets of identical data have been output. In fact, if you scroll down the report, you will see there are two sets of data being output for every transfer order that meets the report’s filter criteria. Why two sets? In this case, we have asked for 1 copy (i.e. the original report plus one copy of it), so the report seems to be printing all the original and copy information on the same page.
  5. The “Shipment Method” heading is missing from the bottom left of the report.

If you switch to Print Layout, things get even more perplexing. You suddenly end up with two pages instead of one, and, stranger still, you end up with different from/to warehouses on each page.

Now let’s have a quick look at the RDLC layout, as follows:

Microsoft Dynamics NAV 2009 RDL Report Conversion Part 5 Sample 3 Screenshot

At first glance, the layout appears to contain the basic header/details structure we’re after. But if you look closer, you start to spot a few basic problems:

  1. The report’s far too wide at 12.5 inches.
  2. A large number of invisible Textboxes have been inserted by the Create Layout Suggestion process (identified by their red font color).
  3. All the data is being presented in a table.

If you are familiar with RDLC reporting controls, it is Point 3 that should immediately draw your attention. The Table data region is designed to expand vertically down a page to accommodate a variable number of records; it is not designed to print one record or one set of records per page.

The RDLC reporting control you want for that job is the List data region. So let’s start by doing the following:

  1. Drag a List data region onto the RDLC reporting surface.
  2. Cut and paste the table inside the List data region.
  3. Reposition your combo List-Table data region to its rightful place.

Simply placing your details table inside a List data region won’t do the trick, however. If you read the Visual Studio help on List data regions, you will see their description is “A list data region repeats with each group or row in the report dataset”.

If you refer back to the way the data set is constructed for RDLC reports, you will quickly realize that repeating with each row won’t work in this case, as the dataset will contain one flattened row for every transfer order detail record in the report (see Converting Dynamics NAV Classic Reports To RDLC – Part 1 if you don’t understand why). What you need to do is group the list on some field. But which field?

Common sense suggests you’d group on the transfer “No.” field, but that won’t work because you have to contend with copies, remember? There could be more than one set of records in the dataset per transfer order.

A quick perusal of the RDLC dataset shows there is in fact no field that can help you distinguish between copies. That means you’ll have create one in the data items of the classic report. However, to figure out how to do that, you’ll first have to understand how the classic report works.

Next Post

In our next post, we’ll continue our repairs to the RDLC version of Report 5703 – Transfer Order post conversion.

4 Responses to Converting Dynamics NAV Classic Reports To RDLC – Part 5

Leave a reply

U.S. (Chicago) Office:

18W140 W. Butterfield Road
15th Floor
Oakbrook Terrace IL 60181
Ph: 630-858-7388
nav@libertygrove.com

Canadian Office:

4711 Yonge Street
10th Floor
Toronto ON M2N 6K8
Ph: 416-646-8484
nav@libertygrove.com

© 1999-2017 Liberty Grove Software Inc. | Privacy Policy