Walkthrough: Redesigning a Customer List Report
In this walkthrough, you will learn how to redesign the Customer List report from a Classic report layout to a client report definition (RDLC) report layout.
About This Walkthrough
This walkthrough illustrates the following tasks:
Using the create layout suggestion function to suggest an RDLC layout for the report.
Manually modifying the RDLC layout.
Saving the layout and compiling the report.
Transforming the report request form with the form transformation tool.
To complete this walkthrough, you will need:
Microsoft Dynamics NAV 2009 installed with a developer license.
All Microsoft Dynamics NAV 2009 requirements met. For more information, see Microsoft Dynamics NAV 2009 SP1 Requirements in the Microsoft Dynamics NAV 2009 Installation and Configuration Help.
Microsoft Visual Web Developer or Visual Studio installed. For more information, see the Requirements for Additional Features and Options section of Classic Client Requirements in the Microsoft Dynamics NAV 2009 Installation and Configuration Help.
Basic knowledge of Visual Studio Report Designer. For more information, see Report Designer (Visual Studio).
Simon is a Microsoft Certified Partner working for CRONUS International Ltd. He has been asked to create an RDLC layout for the Customer List report that CRONUS currently uses with the Classic client.
Creating the Suggested Layout
The create layout suggestion function automatically suggests an RDLC report layout. Use the following procedure to create the suggested layout and view it in Visual Studio.
To create the suggested layout
In the Classic client, on the Tools menu, click Object Designer.
In Object Designer, click Report, select Report 101, Customer List, and then click Design.
On the Tools menu, select Create Layout Suggestion. A suggestion for an RDLC report layout is created.
If you have already created a layout suggestion or have edited this report layout in Visual Studio, a message is displayed and asks if you want to overwrite the existing layout. Because report 101 is a standard application report, it already has an RDLC layout. For the purpose of this walkthrough, you can overwrite the existing layout. If you want to edit the existing layout instead of creating a new layout suggestion, on the View menu, click Layout.
You must complete the additional checks and manual modifications in the following procedures before the report layout is complete.
Modifying the Customer List Report RDLC Layout
Hidden fields in the RDLC report layout will cause formatting problems when you print the report because these fields are outside the width of standard paper. To eliminate the formatting problems, you must move these hidden fields to another location on the report that is within the width of standard paper..
To move the hidden fields
In Visual Studio, in the Report.rdlc file that was created, in the Body section of the layout, select the following hidden fields on the right side of the table:
Right-click the selected fields, and then click Cut.
Right-click the row handle of the last row, and then click Insert Row Below to insert a new row in the table.
Right-click the first field in the new row, and then click Paste.
On the View menu, click Properties Window.
Select the new row. In the Properties window, under Layout, change the value of the Height property to 0.2cm. The height of 0.2 cm is large enough that you can view the row in the layout but small enough that it will not cause formatting problems when you print the report.
This report has unsupported code for the RoleTailored client on the section trigger for Customer, Header (3). You must add the functionality for this code elsewhere in the report so that it will run in the RoleTailored client report.
If you plan to use the Classic report layout, then you need to keep the unsupported code. When you run the report in the Classic client, this code will run.
To add the functionality from the section trigger
In Visual Studio, on the View menu, click Properties Window.
In the Report.rdlc file, in the Body section of the layout, select the field at the top of the layout with the following value:
In the Properties window, under Appearance, expand Visibility.
In the drop-down list for the Hidden field, select <Expression>.
In the Expression window, enter the following expression: =IIF(Fields!CustFilter.Value<>"",False,True)
Saving the RDLC Report Layout
You must save the RDLC layout, and you must also save and compile the changes in the Classic client.
To save the report
In Visual Studio, on the File menu, click Save report.rdlc.
If you close the report in Object Designer in the Classic client and then make changes in Visual Studio Report Designer and try to save the RDLC layout, then you will get the Save As dialog box. This is because the RDLC layout that you are trying to save is not connected to Object Designer. When you closed the report in Object Designer, the version of the RDLC layout that was connected to Object Designer was saved in the report, and then deleted.
Close Visual Studio.
In the Classic client, select an empty line in the report in Object Designer. The following message appears:
The layout of report id: '101' is changed by another application.
Filename of the changed RDLC: <filename>
Do you want to load the changes?
Click Yes to load the changes that you made to the RDLC layout in the Classic client.
On the File menu, click Save.
In the Save dialog box, select Compiled, and then click OK.
Close the report in Object Designer.
Transforming the Request Form
In addition to creating an RDLC layout for the report, you must use the form transformation tool to transform the request form that allows you to select filters for the report.
To transform the request form
Install the form transformation tool. For more information, see How to: Install the Form Transformation Tool.
In the Classic client, on the Tools menu, click Object Designer.
In Object Designer, click Report, and then select Report 101, Customer List.
On the File menu, click Export.
In the Export Objects window, enter Report101_Forms.xml for the name of the file. Browse to the folder where the Microsoft.Dynamics.Nav.Tools.FormTransformation.exe file is located, and then click Save.
Edit the Microsoft.Dynamics.Nav.Tools.FormTransformation.exe.config file.
Change the name of the Forms.xml file to Report101_Forms.xml.
<add key="FormsFile" value=".\Report101_Forms.xml" />
Change the name of the output pages.xml file to Report101_Pages.xml.
<add key="PagesFile" value=".\Report101_Pages.xml" />
Run the form transformation tool. For more information, see How to: Run the Form Transformation Tool.
In the Classic client, click Tools, and then click Object Designer.
On the File menu, click Import.
In the Import Objects window, in the Files of type drop-down list, select XML Format (*.xml), browse to the folder where the Report101_Pages.xml file is located, select Report101_Pages.xml, and then click Open.
In Object Designer, click Report, and select report 101.
On the Tools menu, click Compile, and then click Yes.
To view the RDLC report layout, type the following command at a command prompt: