Microsoft Dynamics NAV 2013 - 80433 - Reporting

March 29, 2018 | Author: Ramin Marghi | Category: Page Layout, Microsoft Dynamics Nav, Microsoft Visual Studio, 64 Bit Computing, Microsoft


Comments



Description

Course 80433: Reporting in Microsoft Dynamics® NAV 2013 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement This courseware is provided “as-is”. Information and views expressed in this courseware, including URL and other Internet Web site references, may change without notice. Unless otherwise noted, the examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred. This courseware does not provide you with any legal rights to any intellectual property in any Microsoft product. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this courseware may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means or for any purpose, without the express written permission of Microsoft Corporation. Copyright © 2012 Microsoft Corporation. All rights reserved. Microsoft®, Microsoft Dynamics®, Microsoft® PowerPoint®, Microsoft® SQL Server® data management software and Microsoft Dynamics® NAV are trademarks of the Microsoft group of companies. All other trademarks are property of their respective owners. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Table of Contents Introduction Microsoft Dynamics Courseware Overview………………………………………………..…………….….....0-3 Student Objectives………………………………………………………………………………………..…………….….0-4 Module 1: CREATING REPORTS Lesson 1: Prerequisites .................................................................................................................................1-4 Lesson 2: Anatomy of Reports...................................................................................................................1-6 Lesson 3: Creating the Dataset .............................................................................................................. 1-13 Lesson 4: Creating the Layout ................................................................................................................ 1-16 Lesson 5: Dataset Patterns ....................................................................................................................... 1-30 Lesson 6: Report Properties ..................................................................................................................... 1-38 Lesson 7: Building the Request Page ................................................................................................... 1-42 Lesson 8: Sorting and Filtering ............................................................................................................... 1-45 Lab 1.1: Creating a Table Report ........................................................................................................... 1-52 Lab 1.2: Creating a Matrix Report ......................................................................................................... 1-66 Lab 1.3: Adding a Chart ............................................................................................................................ 1-71 Lab 1.4: Using a Gauge ............................................................................................................................. 1-75 Module 2: INTERACTIVE FEATURES Lesson 1: Working with Headers and Footers .....................................................................................2-3 Lesson 2: Grouping ..................................................................................................................................... 2-16 Lesson 3: Using Images in a Report ..................................................................................................... 2-45 Lesson 4: Print Preview and Print Layout ........................................................................................... 2-51 Lesson 5: Working with Visibility Options ......................................................................................... 2-52 Lesson 6: Interactive Sorting ................................................................................................................... 2-55 Lesson 7: Working with Document Maps .......................................................................................... 2-62 1 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Reporting in Microsoft Dynamics® NAV 2013 Lesson 8: Creating a Multi Column Report ....................................................................................... 2-65 Lesson 9: Formatting Reports and Report Items ............................................................................. 2-67 Lab 2.1: Adding Visibility Options ......................................................................................................... 2-77 Lab 2.2: Adding Interactive Sorting ...................................................................................................... 2-83 Lab 2.3: Adding a Document Map........................................................................................................ 2-86 Lab 2.4: Adding Pictures to a Report ................................................................................................... 2-88 Module 3: ADDING CODE TO A REPORT Lesson 1: Using Variables and C/AL Code in a Report .....................................................................3-3 Lesson 2: Working with Report Expressions ...................................................................................... 3-11 Lesson 3: Understanding and Using Simple and Complex Expressions ................................. 3-20 Lesson 4: Expression Examples ............................................................................................................... 3-30 Lesson 5: Anatomy of the Sales Invoice Report ............................................................................... 3-46 Lab 3.1: Adding Conditional Formatting to a Report – Part I ................................................... 3-65 Lab 3.2: Adding Conditional Formatting to a Report – Part II ................................................... 3-69 Lab 3.3: Cleaning Up the Report and Using the Company Logo from the Database ....... 3-77 Module 4: DESIGN CONSIDERATIONS Lesson 1: Report Patterns and Recipes ..................................................................................................4-2 Lesson 2: Report Rendering Considerations ..................................................................................... 4-25 Lesson 3: Pagination .................................................................................................................................. 4-29 Lesson 4: Useful Information .................................................................................................................. 4-33 Lab 4.1: Creating Green Bar Reports .................................................................................................... 4-52 Lab 4.2: Creating a Top X Report .......................................................................................................... 4-56 2 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Table of Contents Module 5: RUNNING REPORTS Lesson 1: The ReportViewer Control .......................................................................................................5-2 Lesson 2: Run a Report in Microsoft Dynamics NAV ........................................................................5-5 Lesson 3: Hyperlinks to Reports ............................................................................................................. 5-12 Lesson 4: Run a Report from the SharePoint Site ........................................................................... 5-24 Lesson 5: Hyperlinks in a Report ........................................................................................................... 5-26 Lesson 6: Run a Stand-Alone Report in Visual Studio ................................................................... 5-33 Lesson 7: Interesting Links ....................................................................................................................... 5-39 Lab 5.1: Add a Report to the RoleTailored Client ........................................................................... 5-42 Lab 5.2: Call a Report from a Web Service ........................................................................................ 5-47 Module 6: UPGRADE REPORTS Lesson 1: How to Upgrade a Report to Microsoft Dynamics NAV 2013 .................................. 6-2 Lesson 2: Optimize the Dataset for the New Report Dataset Designer .................................... 6-7 Lesson 3: The Windows Page File ......................................................................................................... 6-10 Lesson 4: Optimize the Layout for RDLC 2008 ................................................................................ 6-12 Lesson 5: Determining which Reports to Upgrade ........................................................................ 6-18 Lab 6.1: Redesigning a Customer List Report ................................................................................... 6-21 Lab 6.2: Redesigning a Customer - Order Summary Report ...................................................... 6-27 3 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Reporting in Microsoft Dynamics® NAV 2013 We created this additional Table of Contents to assist you in quickly finding out the areas that are new and, or changed from the Microsoft Dynamics NAV earlier version for this course. These areas are identified with this icon throughout the training material. Module 1: CREATING REPORTS Lesson 5: Dataset Patterns ....................................................................................................................... 1-30 Module 2: INTERACTIVE FEATURES Topic 3: Table Header and Footer ...........................................................................................................2-8 Topic 1: Group Header and Footer....................................................................................................... 2-16 Demonstration: Add a Parent or Child Row or Column Group to a Tablix ........................ 2-18 Demonstration: Add an Adjacent Row or Column Group to a Tablix .................................. 2-19 Demonstration: Edit a Row or Column Group in a Tablix Data Region............................... 2-20 Demonstration: Delete a Group from a Tablix .............................................................................. 2-21 Topic 2: Using a Stepped Report ........................................................................................................... 2-22 Demonstration: Create a Sstepped Rreport.................................................................................... 2-22 Demonstration: Adding Interactive Sorting - No Grouping .................................................... 2-57 Demonstration: Adding Interactive Sorting - Grouping (Group Header Field) ................ 2-57 Demonstration: Adding Interactive Sorting - Grouping (Detail Field) ................................. 2-60 Lesson 8: Creating a Multi Column Report ....................................................................................... 2-65 Lesson 9: Formatting Reports and Report Items ............................................................................. 2-67 Module 3: ADDING CODE TO A REPORT Topic 1: Understanding Display Text for Expressions .................................................................... 3-20 Module 4: DESIGN CONSIDERATIONS Topic 2: Dashboards ......................................................................................................................................4-9 Topic 4: SAVEASEXCEL, SAVEASPDF and SAVEASWORD............................................................. 4-27 4 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Table of Contents Module 5: RUNNING REPORTS Lesson 1: The ReportViewer Control .......................................................................................................5-2 Lesson 4: Run a Report from the SharePoint Site ........................................................................... 5-24 Demonstration: Creating a Link from a Report to a Report ..................................................... 5-30 Lesson 6: Run a Stand-Alone Report in Visual Studio ................................................................... 5-33 Topic 1: Run an Offline Report ............................................................................................................... 5-33 Lesson 7: Interesting Links ....................................................................................................................... 5-39 5 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Reporting in Microsoft Dynamics® NAV 2013 6 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement mobile devices. This module overview describes the main differences between Microsoft Dynamics NAV 2013 and all previous versions. Web applications) or hardware platforms (computer. is the data tier. The introduction of Microsoft Dynamics NAV 2013 means the end of the two-tier architecture. Microsoft opened the gates for client applications other than the Classic client. and a NAS services client for programmatic access. and so on). This means that the object (and its business logic) is made available as a . Openness The new architecture allows objects (pages and codeunits) to be exposed as web services. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1-1 . Microsoft Dynamics NAV 2013 is built on a three-tier architecture model. Multiple Clients This technological innovation had another impact. It also describes the competitive advantages of the Microsoft Dynamics NAV 2013 release. including web service clients. augmented by Microsoft Dynamics NAV 2013 database components.NET assembly. Like the previous version. By making the business logic available on a separate tier and as a . It is now possible to develop applications on multiple software (WinForms. • SQL Server. Although the two-tier architecture has proven its value through the years. the three-tier architecture offers many competitive advantages.NET assembly and can be called from any external application speaking SOAP (Simple Object Access Protocol). managing all business logic and communication. More information on the architecture is covered in the course Installation and Configuration in Microsoft Dynamics NAV 2013. a SharePoint client through Microsoft Dynamics NAV Portal Framework. Microsoft Dynamics NAV 2013 also supports additional client types. • Microsoft Dynamics NAV Server is the middle or server tier. • The RoleTailored client is the client tier. • In addition. Microsoft Dynamics NAV Web client.MODULE 1: CREATING REPORTS Module Overview Microsoft Dynamics® NAV 2013 is one of the most innovative releases in the product’s history. pages have no fixed width and height. Unlike classic forms. Enhanced Productivity through the RoleTailored Interface The interface of the Dynamics NAV is role tailored. the new solutions needed to support multiple display targets in an easy way. Since the business logic is no longer executed on the client. Pages are the RoleTailored client.Reporting in Microsoft Dynamics® NAV 2013 The following can be considered Microsoft Dynamics NAV clients because they interact with the Microsoft Dynamics NAV database through Microsoft Dynamics NAV Server. In the RoleTailored client. Instead of having to search for a specific function in the menus. which results in higher productivity. which means it is built around the way users work and the tasks they execute in their daily job. 1-2 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . • RoleTailored client • Microsoft Dynamics NAV Portal Framework • Microsoft Dynamics NAV web client • SOAP web service client • OData web service client • NAS services client All of the clients mentioned here also share the same business logic. Microsoft has solved these challenges by introducing pages and by further integrating with other Microsoft products. The two areas severely impacted by this architecture are data presentation and reporting. This course describes the reporting solution. some of the functionalities required (major) design changes. users have instant access to all the relevant features they need. the interface is optimized for employees to fulfill their jobs. Although the new architecture made the product more open. but resize automatically in the function of the display target. the equivalent for the Classic form object. The reporting solution in Microsoft Dynamics NAV 2013 is taking advantage of the enhanced functionalities of RDLC 2008. it also implied certain challenges. It offers functions that are relevant for a specific task. In addition. such as Microsoft Visual Studio® and the ReportViewer control that supports a local processing mode that allows you to run Client Report Definition files (RDLC). • Describe the prerequisites for report development in Microsoft Dynamics NAV 2013. • Demonstrate how to view the dataset at runtime. variable and expression. • Know how to build a request options page for the RDLC report layout. • Learn how to implement sorting and filtering in Microsoft Dynamics NAV 2013 reports. • Explain how to include a label. • Document the User Experience (UX) guidelines for reports in Microsoft Dynamics NAV 2013. • Explain the creation of the layout of a report. • Explain where to find more information about Microsoft Visual Studio 2010. • Understand the creation process for the dataset. • Know how frequently used report properties are implemented in Report Definition Language Client (RDLC) report layouts. • List the software prerequisites for report development. • List the hardware prerequisites for report development. • Know how frequently used report properties are implemented in RDLC report layouts. • Understand the rules for flattening data. • Explain the structure of reports in Visual Studio Report Designer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1-3 . • Understand the steps involved in creating a basic report. • Understand the way a report layout is designed and executed. • Describe how to set page options. • Describe the roles of reports and know the anatomy of a report. paper size.Module 1: Creating Reports Objectives The objectives are: • Describe the roles of reports and know the anatomy of a report. • Know what the request options page in a report is used for and how to build a request options page for the RDLC report layout. Visual Web Developer FIGURE 1. Visual Studio 2010 Professional or above is required. it is possible to take advantage of the reporting capabilities of Microsoft Report Viewer. Visual Studio Report Designer offers several new options and features. It will include an explanation of the supported version(s) of Visual Studio and how to obtain and install it. Visual Studio 2010 Professional To develop RDLC reports in Microsoft Dynamics NAV 2013. due to its thorough integration with Microsoft SQL Server.1: VISUAL STUDIO CHECKLIST 1-4 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . • Richer formatting • Interactive sorting • Graphics and charts • Export possibilities (PDF. Furthermore. including the following. Microsoft® Office Excel® and Microsoft® Office Word®) When you install Microsoft Visual Studio 2010 Professional (or a higher stock keeping unit (SKU)) you must select at least the following option. Visual Web Developer.Reporting in Microsoft Dynamics® NAV 2013 Prerequisites The prerequisites for report development in Microsoft Dynamics NAV 2013. as shown as in the following illustration. microsoft. MSDN subscriptions.com/fwlink/?LinkId=267134 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1-5 .6 GHz or faster processor • 1 GB (32 Bit) or 2 GB (64 Bit) RAM (Add 512 MB if running in a virtual machine) • 3 GB of available hard disk space • 5400 RPM hard disk drive • DirectX 9 capable video card running at 1024 x 768 or higherresolution display • DVD-ROM Drive More information More information about Microsoft Visual Studio 2010 is available at the Microsoft website http://go. • A computer that has a 1. For more information on Visual Studio products and solutions. visit http://go. the versions that are available and how to obtain them. including trials.microsoft. • 32-Bit (x86) • 64-Bit (x64) Hardware Requirements To run Microsoft Visual Studio 2010. partners.com/fwlink/?LinkId=267133 For additional resources on getting started with Visual Studio products. you will require the following hardware. version 2010.all editions except the Starter Edition • Windows 7 (x86 & x64) • Windows Server 2008 (x86 & x64) with Service Pack 2 • Windows Server 2008 R2 (x64) Supported Architectures include the following. case studies and more.com/fwlink/?LinkId=267132 Here you can discover what is new in Microsoft Visual Studio Professional. • Windows Vista (x86 & x64) with Service Pack 2 .Module 1: Creating Reports Software Requirements Visual Studio 2010 can be installed on the following operating systems.microsoft. visit http://go. The report description includes both the logical and the visual design and is not directly visible to the user. such as updating all prices in the item list. report 206. • Automate recurring tasks. Typical examples are the Customer . • Print a company's official documents. Sales Invoice prints an invoice together with its relevant information. Adjust Item Costs/Prices. Additionally. 1-6 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . For example. reports developed in Microsoft Dynamics have several purposes that include the following. using a processing-only report makes it easier because of the powerful data modeling available for report design. Creating reports includes designing both the business logic that covers the kind of information the report will contain. A report consists of a report description. and the layout that deals with how the report will look when it is printed.Order Detail (reports 101 and 108). The report description specifies how data is collected (the logical design or the dataset) and presented on screen or on paper (the visual design or layout). This can be performed by using C/AL code in a codeunit. It describes some general concepts related to report objects.Reporting in Microsoft Dynamics® NAV 2013 Anatomy of Reports This lesson describes the roles and components of reports in Microsoft Dynamics NAV 2013. Reports can also include calculations or expressions. Reports are used to print documents such as invoices and to process data without printing anything.List and the Customer . report 794. However. For example. • Print information from a database in a structured way. Report Purposes Reports can print information from a database and they can structure and summarize information. Report objects also contain properties. and an optional request page.Module 1: Creating Reports The following illustration shows components of a report and how they are related in Microsoft Dynamics NAV 2013. you can add a report to the Report tab of a page. code. When you preview a report from a client computer. For example. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1-7 . After you design reports. you design the data model with Report Dataset Designer and you design the layout with Visual Studio Report Designer. the report is displayed using Report Viewer. Summary In Microsoft Dynamics NAV 2013.2: REPORT DESCRIPTION DIAGRAM A report object is composed of a report dataset and a visual layout. FIGURE 1. You design a report by first defining the dataset and then designing the visual layout. triggers. to design a client report definition (RDLC) report. you can make them available in client applications. However. In Report Dataset Designer. When the report is run. You indent the second data item. Reports run in Microsoft Dynamics NAV 2013 are designed in the Microsoft Dynamics NAV 2013 development environment. When a report is based on more than one table. A data item is a table. you indent data items to establish a hierarchy of data items and control how the information is gathered. The Visual Studio Report Designer relies completely on the dataset you define in the Report Dataset Designer. you must set relations between the data items so that you can retrieve and organize the data. • A data item that corresponds to the Sales Order table. each data item is iterated for all records in the underlying table with an appropriate filter defined. which is the Sales Order table. it finds each customer's sales orders by examining the records in the Sales Order table.Reporting in Microsoft Dynamics® NAV 2013 The Structure of Reports in Visual Studio The starting point for designing RDLC report layouts is the Object Designer. • Field in a table • Variable • Expression • Text constant Typically. For example To create a report that displays a list of customers and lists the sales orders that were placed by each customer. you must define the following data items: • A data item that corresponds to the Customer table. As the report works through the records in the Customer table. Defining the Dataset You use Report Dataset Designer in the Microsoft Dynamics NAV development environment to define the dataset of a report. 1-8 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . data items correspond to fields in a table. the RDLC report layout is built in Visual Studio. You build the report dataset from data items and columns. A column can be one of the following. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1-9 . Optionally it can have one Page Header and one Page Footer. A report that is displayed or printed must have a client report definition (RDLC) layout. you can display a report title. With Visual Studio Report Designer. you can also define a number of properties. and user information in the header of a report. • The ability to display RTF text. and you use the header to display information before any data item record is displayed. • The ability to toggle columns so that you can hide or display data. You use Visual Studio Report Designer to design the RDLC layout. request page and controls). When designing reports in Visual Studio. For example. Extra headers or footers cannot be added. • The ability for users to interactively change the column on which data in the report is sorted. • Images and graphs. These properties are saved in the RDLC data.Module 1: Creating Reports Properties The report description contains properties that are related to the report and the properties that are related to the other components of the report (dataset. and it is not possible to add more than one. Microsoft Dynamics NAV 2013 supports RDLC 2008. A report in Visual Studio always has exactly one Body. Triggers Triggers represent predefined events that occur during report execution and that cause the system to execute specific user-definable C/AL statements. you can add useful features to your report layouts. such as: • Links from a field on a report to either a page or another report. • Report triggers • Dataset triggers • Request page triggers • Request page control triggers Designing the Visual Layout You build the visual layout of a report by arranging data items. columns. You generally display most data in the body of a report. Triggers in a report can be divided into the following categories. company. 10 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . You drag report items to the report design surface and then drag report data from the Report Data pane to the report items on the design surface. When the report runs. The placeholder text is display text for an underlying report expression. It will not run the Page Body for each record. During report processing. The report items have an initial layout position that can change when the report is processed.Reporting in Microsoft Dynamics® NAV 2013 You can enable the Header and Footer sections by right-clicking in a blank report area. Matrix Use to display tabular or crosstab data from a report dataset. then the Page Body. Table. to work with data fields. Chart Use to graphically display data from a report dataset. The module on adding code to a report describes how to use expressions and custom coding to work with data fields in the header and footer. it first runs the Page Header. and report names. then enabling or disabling the Page Header and Page Footer sections. Placeholder text appears in text boxes where you have linked data and layout items. report data is substituted for the report expressions and the calculated values replace the placeholder text. in the Page Header sections. now it is possible in RDLC2008. the entire section is deleted. and then the Page Footer. More information on Data Regions is discussed later in this material. Report items are available in the toolbox. This is different from RDLC2005. You can also nest a chart inside a Tablix data region. 1 . Reports use a variety of report items to organize data on a report page. The following list describes typical uses for different report items: Textbox Use for titles. When disabling a Page Header or Page Footer. However. The design surface is not What You See Is What You Get (WYSIWIG). Table and Matrix are templates of a Tablix data region and provide a starting grid layout for data from a report dataset. Gauge Use to present a visual image for a single value within a range of values. Looping through records is done by using a Data Region in the body section. date stamps. The resulting set can then be displayed using grouping and filtering. You drag fields from the Report Data pane and drop them on a Tablix cell for a data region. A List is a template of a Tablix data region and provides a starting layout for data from a report dataset. If PrintOnlyIfDetail is set to False on the parent data item. Use a rectangle to help control how report items such as data regions appear on a report page when the report is rendered. This resultset is the result of the flattening of the indented data items into a two dimensional resultset.Column. Depending on the indentation and relations between data items.Column = Table B. This means that data from multiple tables is joined before it is sent to the client. • Reports with indented data items: This is similar to SELECT Column FROM Table A INNER/OUTER JOIN Table B ON Table A. Rectangle A rectangle can be used as a container for other report items. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . an OUTER JOIN is used. In the report dataset designer there can be multiple data items that might be indented or not. or to the Grouping pane to define groups for the selected data region. Image Use to add existing images to a report. If PrintOnlyIfDetail is set to True on the parent. a resultset is generated at runtime. an INNER join is used. Rules for Flattening Data The RoleTailored client report works with a flattened dataset. The result can be displayed in the body section.11 . • Reports with one data item: This corresponds to a single SELECT Column FROM Table statement.Module 1: Creating Reports List Use to create a free-form layout such as the forms on a webpage. Line Use lines as graphical elements. The rules for flattening data can be described as follows. A typical report uses Tablix data regions. this means that tables will be joined (in reports with multiple tables). Invoice No. The second sales invoice (1002) has one line and is sold without VAT. it is more like a concatenation of multiple resultsets. has four sales invoice lines of (Type = Item) to which two different value added tax (VAT) percentages apply. In this example. 1 . For invoice 1001 six lines are included. To generate the dataset. The first sales invoice header.3: DATASET GENERATION The dataset combines information from three tables. The RoleTailored client works with a flattened dataset. the logical model of the report is used. Once the dataset is available. three posted sales invoices will be printed. to which one single VAT percentage applies. Actually. The two other lines represent the VAT specification lines for the invoice. the dataset can be processed using filtering and sorting and the report can be rendered. grouping and filtering can be needed to display the correct records. The difference with a UNION statement is that both dataitems will have different fields and a different number of columns. the dataset will look like this (not all fields from the sales invoice report are included): FIGURE 1.Reporting in Microsoft Dynamics® NAV 2013 • Reports with multiple data items on the same level: This is similar to a UNION statement. The following dataset generation in both clients is explained based on an example.12 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Invoice 1002 has only one line. The third invoice (1003) has one line. Again. 1001. The first four lines for invoice 1001 relate to the four sales invoice lines. The result of the queries will be one single dataset containing information from multiple tables. In the following illustration. and invoice 1003 has two lines. The report dataset designer now opens.13 . Creating the Dataset This lesson explains how to add data items and columns in the dataset designer. if the report contains several unindented data items. the report will proceed to the next data item. it will try to retrieve the VAT Amount Lines. 3. which results in the dataset that is shown. these smaller recordsets will be merged through a UNION statement. Creating a New Report To create a new report you will create a blank report and use Report Dataset Designer to add items to the dataset. 2. click the Report button on the left side of the window. and all relevant fields will be selected. (In this example. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . on the Tools menu. After handling the sales invoice lines. the Sales Invoice Header and the VAT Amount Line data items will be joined and the relevant fields will be selected from the data item. or use the shortcut Shift-F12. The resulting recordset contains the fields from all data items in the report. it is assumed that no dimensions are specified.Module 1: Creating Reports To select records from a single table. As a final step.) Next. In the next column. the Sales Invoice Header and the Sales Invoice Line table will be joined. In the report dataset designer. you can enter a table name or table number directly or use the lookup button to select the table from the list of tables. the tables will be merged using a UNION statement. In this case. As a result. 1. As an example. several recordsets are now generated in the example. In the development environment. So far. When selecting records from multiple linked tables. Again. you will start by creating a simple list report. In this case. As a result. in reports with indented tables. data items will first be joined using the conditions specified in the DataItemLink property. the first line contains DataItem in the Data Type column. In the Object Designer. Data Source. the results of the SELECT statements must be concatenated. select Object Designer. the Sales Invoice Line and the VAT Amount Line recordsets will be merged into a recordset containing fields from all three tables. Then you will use Visual Studio Report Designer to design the layout of the report. and then click the New button at the bottom of the Object Designer. a simple SELECT statement is used. you can enter 18 as the table number as the Data Source. Address. select the No. In the next column. In the designer. You can select one or multiple fields in the field menu by holding down the SHIFT or CONTROL key. 8. For example. For example. The caption will become available as a parameter in Visual Studio Report Designer. To define the fields that you want to include from the table into the report dataset. The system will. 10. FIGURE 1. you must create a line for every field from the table that you want to include. update the table number to the table name: Customer. The Field Menu window opens. in the DataType column. Phone No. you can enter the name of the data item. 5.. 11. after you leave the column. select Column from the drop-down list. select the Include Caption check box. Make sure to select the Include Caption for all of the rows in the Report Dataset Designer.Reporting in Microsoft Dynamics® NAV 2013 4. and Country/Region Code fields.14 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In the View menu. It is the last column in the report dataset designer. You can leave the default or enter a new name. In the Name column it will set <Customer>. Name. 1 . and it displays a list of fields that you can add to the report dataset. Click the OK button to add the selected fields in the Field menu to the report dataset. To include the caption of a column in the dataset.4: FIELD MENU WINDOW 9. 6. select the Field menu. Name. Repeat steps 1 through 9 in the report dataset designer to add data items and columns until you have added all the fields you want to include in the report. 7. on the first empty line. com/fwlink/?LinkId=267137 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . To add a label that is not related to a column follow the next steps. 1. choose Properties. Compile and save the report. 3. Note: The Common Language Specification (CLS). In Report Dataset Designer. Select a Column data type row for which you want to add a label to the dataset. You can either add labels that are related to another data item. and on the View menu. such as the title of the report. do one of the following: a. Select the Include Caption check box for a Column data type row to add a label for the column. enter the caption. In the Save As dialog box.15 . In the Caption field. choose Labels. such as the caption for a table field. 13. In the Properties window. on the View menu. b. In the Name field. Include a Label You can add a label to the dataset. enter a Name for the report. 1. then in the Properties window specify the values for the CaptionML property. enter an ID for the report. In Report Label Designer. If you have a Multilanguage application. This name is used in the Visual Studio Parameters. Click OK. Compile and save the report. 2. in the Name field. 4. or a caption for a table. On the File menu click Save. set the IncludeCaption property to Yes. is a set of basic language features needed by many applications to fully interact with other objects regardless of the language in which they are implemented.Module 1: Creating Reports 12. 2.microsoft. or labels that are not related to another data item. In Report Dataset Designer. 5. More information about the Common Language Specification. To add a label that is related to a column. visit: http://go. for example. in the ID field. if you want to add a title to the report. add a Common Language Specification (CLS)-compliant name for the label. On the View menu. choose Properties. 6. use the following steps. 14. and Country/Region Code from the Customer table. time and username of the person that executed the report. Address. in the Data Type column. In the Data Source column. then do the following.16 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . enter the variable. Phone No.Reporting in Microsoft Dynamics® NAV 2013 Include a Variable If you want to include a variable in the report dataset. 1. This name is used in the dataset in Visual Studio. Name. Creating the Layout This lesson covers how to create a layout in Visual Studio – (RDLC) It will show this by demonstrating how to create a simple list report. in the Name column. In Report Dataset Designer. enter a CLScompliant name for the variable. In the Data Source column.. In Report Dataset Designer. After you save and compile the report in Report Dataset Designer. in the Data Type column. you will display all the fields that you selected and display the company name in a larger font and then set it to bold. You will also display the date.0. In the Name column. This name is used in the dataset in Visual Studio. 3. you must now design the layout in Visual Studio. 2. In Report Dataset Designer. on a blank line. which includes the following fields: No. 1 . select Column from the drop-down list. enter the source expression. on a blank line. then do the following. For this report. 2. 3. Include an Expression If you want to include a calculation or other source expression in the report dataset. 1. such as FORMAT(TODAY. Creating an RDLC Layout The previous lesson showed how to create the dataset for a report. select Column from the drop-down list. enter a CLS-compliant name for the variable.4). You can use the Lookup button to open the C/AL Symbol Menu dialog box and view the variables for the report. On the View menu. 4. 3. Visual Studio opens. FIGURE 1. Repeat step 4 to add another column. The Report Data window opens. 1.17 . follow these steps. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . From the toolbox. 2. click Report Data. The table has only three columns so you will add two more columns to accommodate all the fields in the dataset.5: ADD A COLUMN TO A TABLE WINDOW The next step is to populate the table with the data from the dataset. drag a Table control to the report layout. 5. On the View menu. 6.Module 1: Creating Reports To create the RDLC layout for the report. choose Layout. Right-click the third column and select Insert Column and then select Right to add a new column. The dataset in Visual Studio contains the dataset items that you added in Report Dataset Designer. 16. double-click ExecutionTime and click OK. click Built-in Fields. and under DataSet_Result. 10. and under DataSet_Result. drag the Address field to the third column. second row of the table in the Data section. 14. 1 . This expression displays the user name for the user that executed the report. second row of the table in the Data section. second row of the table in the Data section. click Built-in Fields. second row of the table in the Data section of the report layout. the username and the company name. 15. 9. and under DataSet_Result. under DataSource. Under Data Sources. field to the forth column. and under DataSet_Result.18 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . drag the No. 11. From the toolbox drag three text boxes and place them above the table in the designer. From the Report Data window. second row of the table in the Data section. Under Category. Under Data Sources. Under Category. Under Data Sources. Under Data Sources. This expression displays the time the report is executed.6: REPORT DATA WINDOW 7. Select and right-click the first text box and the click Expression to open the Expression Properties window. 13.Reporting in Microsoft Dynamics® NAV 2013 FIGURE 1. These text boxes will display the date and time. drag the Name field to the second column. drag the Country_Region_Code field to the fifth column. 12. drag the Phone No. Select and right-click the second text box and the click Expression to open the Expression Properties window. field to the first column. 8. double-click UserID and click OK. and under DataSet_Result. select the Bold check box and then click OK. By doing this. Click Font and set the font size to a larger font and under Style. Repeat this step for the other Captions as in the following screenshot: FIGURE 1. 27. and under Style. 20. you can select 16 for the font size. populate the text boxes with the Captions. 28. For the text boxes in the first row. Click the Font tab. expand the Parameters folder. Note: Visual Studio can remain open in case report development is not completely finished and you want to test and run the report. For example. In the report dataset window. 18. enter the company name. Select and right-click the third text box and the click Text Box Properties to open the Text Box properties window. 17. 21. You will format the text boxes for the field captions in the table to display in bold font. and click OK. you can enter CRONUS International Ltd. 19.7: ADD CAPTIONS TO THE TABLE WINDOW 24. For this walkthrough. Under the General tab. instead of the Windows user ID of the service tier. 26. in the Value drop-down list. caption text box (first column and first row) and click Text Box Properties to open the Properties window. in a three tier environment. Select the No_CustomerCaption and drag it onto the first text box of the header row. 23.Module 1: Creating Reports Note: It is recommended to add the UserID as a column to the dataset.19 . Close Visual Studio to go back to C/Side. 22. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . Select and right-click the No. set the captions to bold. 25. the Microsoft Dynamics NAV user ID will display. On the header row of the table. select Bold and click OK. In the Save dialog box. To run the new report. choose Yes to load the changes that you made to the RDLC layout into the report. 31. The result will look like this: FIGURE 1. in Object Designer. In Report Dataset Designer.8: CUSTOMER LIST REPORT WINDOW 1 . and then choose OK. on the File menu.20 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . select the report and then choose Run. 33. A dialog box shows the following message: The layout of report id: ' <report ID> ' is changed by another application. In the development environment.Reporting in Microsoft Dynamics® NAV 2013 29. In the dialog box. select Compiled. 32. select a new row. 34. Filename of the changed RDLC: ‘ <filename> ’ Do you want to load the changes? 30. choose Save. 7 cm 18 cm (510 pt) Letter Portrait 7.5 in 0.5 in 0.7 cm (785 pt) A4 Landscape 27.5 in 0.5 in 0.5 in 0.5 in 0.5 in 0.Module 1: Creating Reports NAV 2013 UX Guidelines for Microsoft Dynamics NAV 2013 The following information is to be considered as general guidelines and recommendations regarding the user interface of Microsoft Dynamics NAV 2013 reports.5 in 0.5 in (540 pt) Tabloid Portrait 10 in 16 in (1152 pt) Tabloid Landscape 16 in 10 in (720 pt) Report title: Font Segoe UI 14 pt Bold Cell height 20 pt Padding Cell padding: left: 5 pt. All other reports: Left Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . Page Setup: Left Right Top Bottom A4 Portrait 2 cm 1 cm 1 cm 1 cm A4 Landscape 1 cm 1 cm 2 cm 1 cm Letter Portrait 0.5 in 0.5 in Letter Landscape 0. bottom: 0 pt Text alignment Document reports: Right.5 in Tabloid Landscape 0.5 in 0.5 in 0.5 in Tabloid Portrait 0.5 in 10 in (720 pt) Letter Landscape 10 in 7. top: 0 pt. right: 5 pt.5 in 0.21 .5 in Body size: Width Height A4 Portrait 18 cm 27. inches (in) and points (pt). The information used in the following table is shown in centimeters (cm). 22 • Row1: Title: Bold • Row2: Height: 2. you can use your discretion to space the content. bottom: 0 pt Line spacing: • Grid 10 pt. solid. right: 5 pt. bottom: 0 pt All other text: Font Segoe UI 8 pts Regular Cell height 10 pt Padding Cell padding: left: 5 pt.5pt • Row4: Text • Header row can be up to 30 pt in height if required (allowed to be up to 3 lines) • Vertical align: bottom Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . black. right: 5 pt. bottom: 0 pt Space to Body: • Height: 20 pt Headers in the body: Font Segoe UI 8 pt Bold Cell height 10 pt Padding Cell padding: left: 5 pt. top: 0 pt. top: 0 pt.) Table Header: 1 .Reporting in Microsoft Dynamics® NAV 2013 Other text in the header: Font Segoe UI 8 pts Regular Cell height 10 pt Padding Cell padding: left: 5 pt. Multiplication of 10s. right: 5 pt. (As a designer/developer. width: 1 pt • Row3: Height: 2.5pt: Border bottom. top: 0 pt. top :0 pt. “White” • Height: 40 pt • Space below Logo: 10 pt Logo: Text alignment: Numeric/decimal fields right aligned (including header) Text fields left aligned Numeric text left aligned (eg. you can enable an option at runtime in the report viewer. right: 5 pt. “WhiteSmoke”.23 . to view the underlying. can be found here: http://go. including examples. bottom: 0 pt • Vertical align for cells: top (default) • If row below needs to be indented.Module 1: Creating Reports Table content: • Cell height is 10 pt • Cell padding: left: 5 pt.microsoft. dataset that is generated by Microsoft Dynamics NAV. flattened.com/fwlink/?LinkId=267138 Demonstration: How to View the Dataset Using the “About This Report” Feature When you run a report. customer no) Date/time left aligned Link color: • Blue (no underline) Chart color: • Pallette: BrightPastel Additional Reading: More information. add +10 to Left Padding Cell colors: • List reports: Alternate BackgroundColor= mod 2. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . c. e. c. you must run the report. Run your report again to view the dataset. About This Report option. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . b. Then when the report is being executed and displayed in the report viewer. A drop-down menu appears. First. A popup window now appears containing the following message: The About This Report feature is now active. you must enable the About This Report feature. b. a. A popup window now appears that displays the dataset of the report. In this drop-down menu select the Help. This can be achieved by performing the following procedure. 2. you can use the shortcut: Ctrl+Alt+F1. 1 . Repeat steps 1 through 3. In the report viewer. Alternatively. Run the report again. Close the popup window.Reporting in Microsoft Dynamics® NAV 2013 Demonstration Steps 1.24 a. d. Close the report viewer. click the menu at the top-left of the window. o Export as XML: This action will export the dataset to an XML file. o Recipient as Attachment: This action will create a new email and include the dataset as an HTML attachment.9: ABOUT THIS REPORT WINDOW 3. In the Action Pane of the popup window you will find the following actions. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 .25 . a column will appear for every field from the report dataset and a row for every record. o Microsoft Word: This action will export the dataset to a Microsoft Office Word document. In the popup window. o Microsoft Excel: This action will export the dataset to a Microsoft Office Excel document.Module 1: Creating Reports FIGURE 1. 10: PAGE SETUP WINDOW 1 . By default. it will remain so until you close the client.26 o Inches: Specifies the page size in inches. Report. b. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . It is recommended not to enable this feature for every report. To Set Page Options: a. By default. specify the settings you want to use in the Page Setup. your local settings determine the page unit that is selected. Demonstration Steps 1. You can do this via the Menu. o Centimeters: Specifies the page size in centimeters. your local settings determine the page unit that is selected. Demonstration: How to Set Page Options To change the dimensions of the design area for a report. FIGURE 1.Reporting in Microsoft Dynamics® NAV 2013 o Print Page: This option will send the dataset to the printer. Select Page Setup on the Report Properties dialog box to set page options for the entire report. because the dataset is kept in memory and will consume extra resources on the client. Note: Once the feature is enabled for a report. Report Properties and then select Page Setup on the left. select Custom Size and then change the Width and Height controls to reflect the size you want to use. Setting the paper size has no effect on other renderers. To change the paper size. you can export a report to a hard page-break renderer or click the Print button to print a copy of the report. o Landscape: Specifies the page orientation of the report. perform the following steps. o Width: Displays the width of the paper size that is selected in the Paper type list. From the Report Viewer toolbar. Image. The size of the paper determines the number of pages in a report and the report data that fits on each page. including the paper size. Design Considerations.27 . Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 .Module 1: Creating Reports o Portrait: Specifies the page orientation of the report. Use the Report Properties dialog box to change page setup properties. Paper size affects only reports that are rendered with the hard page-break renders: PDF. Portrait indicates that the page is longer vertically. In Page Setup. More information about pagination is provided in module 4. Each option populates the Width and Height properties. Demonstration: How to Set the Paper Size When you print a report. you can specify the size of the paper to use. o Left: Sets the distance between the left edge of the report and the left edge of the report rows. Alternatively. a. o Bottom: Sets the distance between the bottom of the report and the bottom of the last line of the report. Right-click outside of the report body and click Report Properties. select a value from the Paper Size list. o Right: Sets the distance between the right edge of the report and the right edge of the report rows. and Print. Demonstration Steps 1. o Top: Sets the distance between the top of the report and the top of the first line of the report. o Paper size: Select a size from the list that automatically enters the dimensions in the Width and Height controls. c. You might need to set the paper size or other page setup properties. b. Landscape indicates that the page is longer horizontally. o Height: Displays the height of the paper size that is selected in the Paper type list. perform the following steps. menus. various tool windows docked or auto-hidden on the left. e. When you are adding report items to the body of a report. The Microsoft Visual Studio Integrated Development Since the creation of the RDLC layout for reports in Microsoft Dynamics NAV 2013 is managed in Microsoft Visual Studio 2010 it is important to have a good understanding of Microsoft Visual Studio 2010. select Body. the Tablix data region will grow horizontally. b. To do this. Demonstration: How to Set the Body to Fit As demonstrated in the previous topic. As a result. c. Also.28 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . 1 . you can set the paper size of the report in the report properties. Copy the PageSize properties using your mouse or CTRL-C. d. you will notice that the Body of the report might grow. when you run the report. In the drop-down list at the top of the Properties window.Reporting in Microsoft Dynamics® NAV 2013 d. This might increase the size of the body. Demonstration Steps 1. The Visual Studio product family shares a single integrated development environment (IDE) that is composed of several elements: the Menu toolbar. mm. the body will be split over multiple pages. It is recommended to also set the size of the Body to fit the report size. bottom. when you add a column to a Tablix. pt. More information about report pagination is available in the Interactive Features module. In the Size properties. and right sides. paste the copied values using your mouse or CTLR-V. In the drop-down list at the top. Click OK. a. and the size of the report body might become greater than the size of the report. select Report. Size values have a default unit based on the user's local settings. To designate a different unit. You can also specify a custom size by typing numeric values in the Width and Height boxes. or pc after the numeric value. and toolbars available depend on the type of project or file you are working in. Standard toolbar. The tool windows. and the editor space. type a physical unit designator such as cm. Toolbar buttons usually have icons that suggest the underlying commands. Data. Toolbars typically are rows of buttons and other controls (such as combination boxes. list boxes. you can also choose to create new toolbars. related commands are clustered together on the same menu or toolbar. along with enhancements specific to the type of code or markup supported. Like menus. under the menu bar. You can easily drag a control from the toolbox and place it on the design surface. new menus can appear (Format. while the Code editor is the basic source code editor. share many of the features found in the Code editor. To add additional toolbars. Other editors. right or bottom side of the IDE. the HTML Designer. Website. and splitter controls) that are associated with commands. View. such as a printer for a Print command. Design View lets you specify the location of controls and other items on the user interface or webpage. Each menu contains commands and command groups. Edit. such as printing a document. Window and Help. select View. Some familiar menu names are File.Module 1: Creating Reports Menu Bar The menu bar appears at the top of the IDE and gives access to all features and commands in the Visual Studio IDE. not all available toolbars are displayed. Tools. refreshing a view. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . Toolbars Toolbars are normally displayed at the top of the IDE. its associated command is activated. and code snippet insertion. When you click a toolbar button. such as the CSS editor. This view supports coding help such as IntelliSense. text boxes. collapsible code sections. From the same menu. Editors and designers usually have two views: a graphical design view and the code behind view (or source view). Other features include bookmarks and displaying line numbers. toolbars are convenient graphical ways to present commands to users. Editors and Designers Microsoft Visual Studio includes multiple editors and designers that depend on the type of file or document that you are authoring. Commands are functions that either launch submenus or accomplish tasks. The Text editor is the basic word processor of the IDE. Depending on the type of project you are creating. but can be moved and docked to the left. By default. and the Web Page Designer. and Report). Typically. code refactoring.29 . Source View displays the source code for the file or document. Toolbars and check the toolbars to display. or creating a new file. The toolbox window is often autohidden. The contents of the window will be refreshed when you select another file in the Solution Explorer. When working in the code editor.30 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . where report developers confront a particular challenge while having multiple source tables as the input. their projects. the window will show the properties of the field that is selected in the Solution Explorer. the code editor will contain a tab. This view is called the Split View. For each file that is opened in a project or solution. the name of the code trigger being edited is visible. and item properties. Toolbox The toolbox contains a list of controls that you can add to the design view of the project. drag and drop it to the Design view. also provide a hybrid view where both the graphical and code view of a file are visible simultaneously. You can add new controls to the toolbox by right-clicking the toolbox and selecting Choose Items. table row. This lesson focuses on the first part. To add controls from the toolbox to your project. but a single consolidated data set as the output. Dataset Patterns Reports in Dynamics NAV 2013 are executed in two steps. and the items in those projects. Solution Explorer The Solution Explorer displays solutions. which reflect the two steps in the report design: first data set design in CSIDE followed by report layout design in Visual Studio: 1. add new files to a project. At startup. performs necessary calculations and combines the data in a single flattened dataset. From Solution Explorer. In the editor. This is performed by the NAV server. Properties Editor The Properties window contains all properties for the item that is selected in the editors or designers. The C/AL runtime retrieves the data from the involved source tables. project. You can easily switch from one file to another by clicking the tab. you can open files for editing.Reporting in Microsoft Dynamics® NAV 2013 Some editors. The contents of the toolbox will vary depending on the type of project you are editing. The produced dataset is transferred to the report viewer’s run-time hosted on the NAV client. such as the Web Page Designer and HTML Designer. or any object in the designers (text box. and so on). and view solution. which in turn renders the dataset data according to the report layout definition. 2. 1 . you can have multiple files opened at a time. The “Line” table represents a simplified order line with the “No.31 .Module 1: Creating Reports The following examples illustrate and explain most of the typical patterns for data set design in Dynamics NAV reports in an easy to understand way. which resemble the popular header-line pattern. “Header No.” field as the primary key. which has an integer “No. Item Quantity 111 11 Bicycle 1 222 11 Armchair 1 333 11 Toolkit 1 444 22 Armchair 2 555 22 Bicycle 2 666 44 Toolkit 4 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 .” field as the primary key and “Customer” fields to hold the customer name. Name 11 Selangorian Ltd. Demonstration Data To illustrate we introduce two simple NAV tables. Various combinations of these patterns appear in real-life Dynamics NAV reports. The “Header” table represents a simplified document header table. 22 London Postmaster 33 Meyers Design 44 Total Solutions Inc.” is a reference to the “Header” table. No. Header No. No. The tables are populated with several rows of sample data. while the “Item” and “Quantity” fields represent the payload of the order line. As shown on the following screenshot.” field with Header.) The resulting dataset at runtime contains 7 rows as shown in the “About this Report” feature: FIGURE 1. which connects Line.Reporting in Microsoft Dynamics® NAV 2013 Linked Data Items This is a very common pattern for the datasets in Dynamics NAV reports.32 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .” field is defined as: Header No.”No.12: DATASET OF REPORT WINDOW 1 . the “Line” data item is nested in “Header” data item: FIGURE 1.=FIELD(No.”Header No.11: DATA ITEM DESIGNER WINDOW Note: The table relation. then the report does not print data from the current record in the parent data item. Linked Data Items with PrintOnlyIfDetails This example has the same data set design as above. even though there is no data for the child data item. The produced data set is much equivalent to SQL LEFT Join operation on “Header”-“Line” tables. If this property is Yes and there is no record in the child data item that corresponds to the current record in the parent data item. then the report iterates through each parentchild relationship in the same way. If this property is No and there is no record in the child data item that corresponds to the current record in the parent data item. since the header row “33” – “Meyers Design” has no single linked line. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . header 11 is connected to 3 lines and as a consequence in each of the 3 records the header fields are repeated. FIGURE 1.33 .Module 1: Creating Reports The fields from the header data item are repeated on the records from the related line data item. If there are more than two data items.13: USING PRINTONLYIFDETAILS WINDOW The property PrintOnlyIfDetails specifies whether to print data in a report for the parent data item when the child data item does not generate any output. Note: The PrintOnlyIfDetails property has no effect on a data item that does not have any child data items. Another way to achieve the result of not printing blank lines is to add a filter on the table. all the fields from “Line” for this header are empty (marked as null). In the resulting dataset certain fields might have no values. then the report prints data from the current record in the parent data item. but the data item property PrintOnlyIfDetails property of the header data item is set to Yes. For example using the SETFILTER Function (Record). In this example. For example. 14: PRINT ONLY IF DETAILS WINDOW The produced data set is now similar to a SQL INNER Join operation on “Header”“Line” tables.15: NO DATAITEMLINK WINDOW 1 . Nested Data Items without Link In this example there are still two nested data items.Reporting in Microsoft Dynamics® NAV 2013 The resulting data set has fewer rows than above. FIGURE 1.34 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . “33” – “Meyers Design”) are excluded. since the Header lines without related Line records (e. which effectively disconnects lines from the headers.g. however the properties DataItemLinkReference and Data Item Link aren’t set. Subsequently there are also no “null” fields anymore. FIGURE 1. Module 1: Creating Reports The resulting data set is much larger.35 . In this example we introduce another data item from the Integer table. for example when producing several copies of certain rows or groups of rows in the resulting dataset. which encloses the Header-Line data items ones. however it is widely used in case if one of the data items refers an Integer table. The purpose of such a design is to repeat Header-Line rows multiple times. for example to provide several copies of the same document. the resulting dataset will contain 24 rows. since it includes all possible combinations of headers and lines. FIGURE 1.16: DATASET NO DATAITEMLINK WINDOW Linked Data Items with an Integer Table The data set design from previous examples is not very practical for header-line reports. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . with absolutely no regard to their possible table relations. Since in our example there are 4 headers and 6 lines. 18: DATASET OF INTEGER DATAITEM WINDOW 1 .Reporting in Microsoft Dynamics® NAV 2013 The following is a screenshot of the Report Dataset Designer of the report: FIGURE 1. that the outer data item will produce exactly two rows from the Integer table.17: INTEGER DATAITEM IN DATASET WINDOW Note: The expression WHERE(Number=FILTER(1..2)) in DataItemTableView property of the Interger data item makes sure.36 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . The resulting data set now contains two identical set of Header-Line rows complemented by the NoOfCopy_Integer field: FIGURE 1. 37 . Equally Nested Data Items In this example the same indentation level is used for both data items: FIGURE 1. FIGURE 1. for example a List or Table.20: RESULTSET OF UNINDENTED DATAITEMS WINDOW Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 .19: UNINDENTED DATAITEMS WINDOW The resulting data set combines the rows from both data items as in the following screenshot.Module 1: Creating Reports The field NumberOfCopies_Integer is available in the dataset and can be used in the group expression of a data region. Additionally. 1 . a report will be printed immediately). then the printer uses the default tray that is specified by the printer driver. or will only be able to process data.Properties window. This lesson describes some properties that are frequently used in the report. No graphical output is produced. The list contains 13 standard trays and 16 printer-specific trays. it is not possible to insert an RDLC layout. (Any RDLC data part will be removed when setting the property to Yes. Report Properties When designing reports in Microsoft Dynamics NAV. Report Properties Properties occur on many different levels in the report description. If the printer that is used for this report does not support the specified paper source. The following list shows the properties on the report level that are frequently used when designing reports.) PaperSourceFirstPage. The data set output is similar to SQL UNION operation on “Header”-“Line” tables. the Print and Preview buttons in the request options form or page are replaced by an OK button. but with empty fields for the Header table.38 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . UseRequestPage You can use this property to decide whether the user of the report will be presented with a request page or not. in the PaperSourceFirstPage field. This property overrules any request page from the report. followed by all the Line rows. but with empty fields for the Line table. choose the paper source. Much can be done using properties. ProcessingOnly This property is used to set whether a report will produce graphical output. If UseRequestPage is set to No.Reporting in Microsoft Dynamics® NAV 2013 All the rows from the Header table are included. This implies that the user will not be able to choose a sorting order or to set filters and that the print dialog box will not be shown (that is. you can achieve good results without writing a single letter of code. no request page will be shown. PaperSourceDefaultPage and PaperSourceLastPage: In the Report . If ProcessingOnly is set toYes. If you do not specify a value for the PaperSourceFirstPage/PaperSourceLastPage property. it is used together with the filters that the user specifies in the request page. does not inhibit the user from selecting a key or adding another filter. then the printer uses the default printer tray that is defined for the operating system. or both. Selecting a sorting order or a filter. If a filter is selected. The printer specific trays that are contained in the list are intended for use with printers that have other paper sources than the standard ones that are listed in the property. then the printer uses the tray that is specified in the PaperSourceDefaultPage property. then the printer uses the default printer tray that is defined for the operating system. If you do not specify a value for the PaperSourceFirstPage property or the PaperSourceLastPage property. the users of the report will not be able to select any key. If a sorting order is selected.39 . then the printer uses the tray that is specified in the PaperSourceDefaultPage property.Module 1: Creating Reports If you do not specify a value for the PaperSourceFirstPage property. it is suggested as the default if the users of the report select a sorting order. If a key is selected. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . If you do not specify a value for either the PaperSourceFirstPage property or the PaperSourceDefaultPage property. then the printer uses the tray that is specified in the PaperSourceDefaultPage property. Data Item Properties The following list shows the properties on a data item level that are frequently used when designing reports. sorting order or filters for that data item when the report is executed. then the printer uses the default printer tray that is defined for the operating system. there will be no tab for the current data item in the request page. The DataItemTableView property is a part of the logical design and does not apply to the RDLC report layout. sort order and the filter for this data item. If you do not specify a value for the PaperSourceDefaultPage property. As a result. DataItemTableView Use this property to select one of the existing keys and the related. The settings in the Print and Page Setup dialog boxes override the value that is specified for the PaperSourceDefaultPage property. If you do not specify a value for either the PaperSourceFirstPage/PaperSourceLastPage property or the PaperSourceDefaultPage property. When you specify DataItemLinkReference. This property is part of the logical design and impacts the dataset. PrintOnlyIfDetail Use the PrintOnlyIfDetail property to limit printing a data item that does not have a detailed data item. You can specify captions in different languages using the ReqFilterHeadingML property. ReqFilterHeading Use this property to create a caption for the request form tab that pertains to this data item. Even so.Reporting in Microsoft Dynamics® NAV 2013 DataItemLinkReference Use this property to specify the data item on a higher level for the indented data item it will be linked to. If the property is shown as False on the parent data item. The link is defined as a property of the indented data item. it is still recommended to use this property. the user will be able to add other fields and set filters on these fields. If the underlying table has many fields. This property is part of the logical design and impacts the dataset. If the user is not going to be able to put filters on other fields. DataItemLink Use this property to specify the corresponding fields from two data items that are linked by the DataItemLinkReference property.40 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . The user can set filters on these fields. When the request page is in use. you must remove the request page altogether by using the UseRequestPage property of the report. use the DataItemLink property to specify one or more fields from each data item to base the link on. 1 . This property is evaluated when flattening the data. the system uses an outer join select statement. or remove the tab for this data item. ReqFilterFields Use this property to indicate those fields that will automatically be included on the tab of the request page that pertains to this data item. the occasional user of the report might not easily find the relevant fields to filter. by setting a specific key in the DataItemTableView property. PREVIEW function. CurrReport. The OnPostReport trigger will not be called. A typical situation in which you will use the SKIP function is when you want to retrieve records from a related table by using values in the current record for forming a filter. If the values in the current record already indicate that no records from the related table will be retrieved. then you can print from the Print Preview window. BREAK causes the current trigger to end. then the Print icon. If you run a client report definition (RDLC) report layout in preview mode and do not call the CurrReport. CurrReport. If you run a client report definition (RDLC) report layout in preview mode and then call the CurrReport. Print Layout icon. and Save As icon are not displayed. CurrReport. It breaks the iteration of the current data item.PREVIEW function. there are a number of C/AL statements that are often used in reports. CurrReport.Module 1: Creating Reports Report Functions Apart from the properties. If the processing occurs inside a loop. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 .QUIT When you use the QUIT function.Preview This property indicates whether a report is being printed in preview mode. Page Setup icon.SKIP You can use the SKIP function to conditionally skip the processing of the current record.BREAK The BREAK function exits from a loop or a trigger in a data item trigger of a report. the processing continues with the next record after the SKIP function is called. there is no need to perform this processing and you can use the SKIP function to avoid the processing. the report is exited without committing any changes that are already made to the database during the execution.41 . The Request Page A request page is a page that is run before the report starts to execute. Here developers can add controls. When you have compiled the object.Reporting in Microsoft Dynamics® NAV 2013 CurrReport. with the data type Record pointing to the Language table (table 8).LANGUAGE For the documents that you want to print in the language of the recipient. In some cases there is an extra tab called Options that is not related to a data item. Language. click View.42 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Controls that are created in the Request Options Page Designer are always displayed above the FastTabs that correspond to data items. 2. The request page is displayed when the report is run. In the Report Designer. CurrReport. It contains general information that determines the output and the execution of the report. 1. rather than in your own working language. a request page is automatically created for the report. When a new report is created. custom options can be created in the request page. Open the Report Designer from the Object Designer.GetLanguageID("Language Code") For each of these reports. Request pages enable end users to specify options and filters for a report. This functionality is already enabled for most reports in the standard Microsoft Dynamics NAV database. you must insert the following C/AL code as the first line in the OnAfterGet Record() trigger. The following steps show how to open the Request Options Page Designer.LANGUAGE := Language. you can add a single line of code in the document. the request page is displayed. it will no longer print in the user’s working application language if another language is specified in the Customer Card window. The Request Options Page Designer is similar to the Page Designer. you must create a new variable. Request Page. In reports that need the multiple document languages functionality. such as FastTabs and fields to the request page. Additionally. These options are designed by using the Request Options Page Designer that is accessed from the Report Designer. 1 . The document is printed in the language that is specified in the Language Code field in the Customer Card window. Building the Request Page When a report is run. The request page is a special window the user can use to define output options for the report. Its purpose is to let the user provide additional input before previewing or printing the report. choose View. do not define any ReqFilterFields for the data item and set the DataItemTableView property to define sorting. • ReqFilterHeading • ReqFilterHeadingML • ReqFilterFields In addition to specifying options and filters. but some pages might print. It is recommended that you add fields that the end users of the report will frequently set filters on. the functionality can depend on a specific key and sort order. The request page is displayed but there is no tab for this data item. then the report will start to print as soon as it is run. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . If a DataItemTableView is not defined.43 . Additionally. open Report Dataset Designer. and then choose Request Page. a FastTab for defining filters and sorting is created on the request page. an end user can add more fields on which to filter to the request page. refer to the C/SIDE Introduction in Microsoft Dynamics NAV 2013. The fields that you define as ReqFilterFields are shown on the request page. In a complex report that uses data from several tables. Design your reports so that end users cannot change the sort order in a way that affects the functionality of the report. If you set UseReqPage to No. end users cannot cancel the report run. To access Request Options Page Designer. users can choose from the following actions on a request page. In this case. then end users can select a sort field and sort order at runtime.Module 1: Creating Reports You design the Options FastTab of a request page by using Request Options Page Designer in the development environment. To remove a FastTab from a request page. • Print o Print o PDF o Microsoft Word o Microsoft Excel • Preview • Cancel For more information on how to design and edit the Request Page. for every data item in the report. By default. You design the filters on request pages by using the following report properties. It is still possible to cancel the report. Object Designer to open the Object Designer. l. Some customers want to have item pictures included on the sales quote document. Import. Select View. Click the Design button. Select File. Browse to the report R123456704.fob. e. c. f. Object Designer. Mort agrees to change the Request Options Page.44 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . j. Demonstration Steps 1. Request Page. n. and now she has another request for Mort. h. k. Select report 123456704. Open the Microsoft Dynamics NAV 2013 demonstration database. d. Click OK to start the import. i. Click the Report button. Mort is now ready to change the Request Options Page. Select Tools. She asks Mort if it is possible to include this as an option on the Request Options Page. FIGURE 1. Open the CRONUS International Ltd. g. choose to open the Import Worksheet window. Click Open to import the object in the database. In the Action column. In the dialog box. b. a. m. Sales Quote. verify that the action is set to Create.21: REQUEST OPTION WINDOW 1 . Select Tools. To open the Request Page. demonstration company.Reporting in Microsoft Dynamics® NAV 2013 Demonstration: Open the Request Page Susan talks to many customers during her daily job. When specifying a Key in the DataItemTableView property. In this instance. Because a company’s database will grow. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . including the following. You can define up to 40 keys (one primary. do not specify a Key in the DataItemTableView property of the data item. each sort order is directly related to a table key. Remember that the Order selected in the Sort window will overrule the Order specified in the DataItemTableView. Helping users locate the data they need is key and integrating sorting and filtering in reports will provide an added value. the Sort button is removed from the Request Options page. Sorting can be defined several ways. you must keep performance in mind.Module 1: Creating Reports Note: Note that adding a field in the request options page will not change the report layout. Sorting and Filtering When you develop reports for Microsoft Dynamics NAV 2013. In Microsoft Dynamics NAV. In order for the images to show/hide the RDLC layout needs to be updated accordingly. • Use the DataItemTableView property to define the sorting of a data item. you can have as many sorting orders as there are keys in your table.) When a user prints a report. 39 secondary keys) in a table. he or she can click the Sort button and define both the Key and the Order to use in the Sort window. Additionally. Select any of the keys that are defined in the table and also determine the sorting order (ascending or descending). (Specify the Order if necessary. the tab for the corresponding data item is removed from the Request Options page (unless request filter fields are specified in the ReqFilterFields property of the same data item). reports will have to aggregate more data over time. Sorting methods that are defined here cannot be modified by the user.45 . • The user can decide how the data will be sorted. Meaning. Sorting Data Data can be sorted in many ways. and as a result. An alternative and more flexible solution is for the user to select from a limited set of sorting methods on the Request Options page (and then tie the options to a specific SETCURRENTKEY statement). To do this. In Visual Studio Report Designer. 1 . The RDLC report layout offers another option to sort data.Reporting in Microsoft Dynamics® NAV 2013 • Use coding to define the sorting programmatically.46 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . For example. Remember that programmatic sorting overrules the sorting defined in the Sort window or the DataItemTableView property.22: ADDITIONAL SORTING DEFINED IN THE TABLIX PROPERTIES WINDOW You can specify sorting options that do not match an existing key. On the Sorting tab. you can have your sales orders list sorted on Order Date. FIGURE 1. define a custom sorting order. you can specify additional sorting methods for any matrix or table control. although the Sales Header table does not contain a corresponding key. One way is to define the sorting hardcoded in the C/AL Code using the SETCURRENTKEY statement. right-click a table or matrix control and select Properties. The user can decide whether or not to apply any filters. If any filter is specified. The disadvantage is that these filters are inside in the report and cannot be removed by the user. Instead. The report can only serve specific purposes. The disadvantage is that the user can set any filters and possibly manipulate the report output. it is applied. The advantage is that the report output cannot be manipulated. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . all information is available. the filter is applied on the service tier. The filter in the DataItemTableView is not translated into explicit filtering criteria in the RDLC report layout. In this instance the sorting will occur in the Report Viewer and might take longer to complete. • Use the DataItemTableView property to set a filter on a data item inside the report: Filters that are defined inside a report cannot be removed. • Use request filter fields: Request filter fields offer a variable way of filtering information. Hardcoded filters can be set with the SETRANGE and SETFILTER statements. If no filters are specified.Module 1: Creating Reports Note: In the RDLC reports. Filtering Data A user can use filtering to limit the data that is included in a report. before the dataset is sent to the client. The advantage is that the designer can solve multiple reporting needs with one report. Several ways to perform filtering include the following. • Use code to set some filters: Using code to set filters requires both programming skills and access to the C/AL Editor. it is not necessary for the Microsoft Dynamics NAV keys to sort.47 . An alternative for defining hardcoded filters in the C/AL Editor is to use variables on the Request Options page and use these variables as a filter.48 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . To define additional filter criteria. There is no option to specify parameters at runtime. 1 . meaning they must be added to the Report Dataset Designer. Parameters are used only for Captions and Labels.23: TABLIX FILTER PROPERTIES WINDOW Filters that are defined inside Visual Studio cannot be removed by the user.Reporting in Microsoft Dynamics® NAV 2013 Inside the Visual Studio IDE there is another way to define some filters. and select Properties. the variables must be part of the dataset. right-click any table or matrix control. To do this. define the filters. On the Filters tab. Additional filtering can be defined by setting the properties of any Table or Matrix control. FIGURE 1. when you know the values that will be used for the filters in advance. verify that the action is set to Create. If the dataset is larger than the amount of memory that is available. Object Designer to open the Object Designer. He notices that the report contains lines where all the amounts are zero. demonstration company. is using report 123456715. when you design the report. e. The dataset is sent from Microsoft Dynamics NAV Server into the memory on the client machine. Sometimes. f. He asks Mort to filter the report so that it only contains lines where both the Sales (LCY) and Profit (LCY) fields are different from zero. Select Tools. In the dialog box. with the RDLC layout. c.49 . it means the data will be fetched from the database. To avoid this scenario you can try to reduce the dataset by applying appropriate filters that reduce the amount of data that needs to be retrieved and processed in a report. he wants the details sorted by posting date. then the operating system might stop allocating more memory and the client might stop responding. Demonstration Steps 1. Open the Microsoft Dynamics NAV 2013 demonstration database. Additionally. to calculate and monitor the performance of his salespersons. Select File. a. h. choose to open the Import Worksheet window. you do not know the exact values that will be used for filtering. Import. Salesperson Commission. you can use variables and expressions for dynamic filtering. then only the required data is fetched from the database and sent to the report viewer. g. the Sales Manager. then sent to the report viewer and then it will be filtered. Open the CRONUS International Ltd. Browse to the report R123456715. b. d. If. variables and parameters to filter in the RDLC layout. To add sorting and filtering.Module 1: Creating Reports Best Practice: It is considered a best practice to avoid filtering in the RDLC layout of the report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . If the filter is applied in the Report Dataset Designer.fob. When you apply a filter in the RDLC layout. in descending order. In the Action column. Demonstration: Adding Sorting and Filtering Kevin. then you can use expressions. However. it is more advantageous to apply the filter(s) in the report dataset instead of in the RDLC layout. Click OK to start the import. Select Table1 in the Body section. select [Cust__Ledger_Entry__Posting_Date_]. u. l. Right-click any cell in the table and choose Select 'Table1'. Select View. k. n. Click Open to import the object in the database. In the Order column. select Z-A. Layout. q. In the Filter list. In the Sort by field. Click the Design button.50 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . m. Select report 123456715. p. r.Reporting in Microsoft Dynamics® NAV 2013 i. Right-click the shaded border and select Properties.24: CHANGE FILTERS WINDOW 1 . add the criteria as shown in the following illustration. Select the Filters tab. Click the Report button. Select the Sorting tab. t. j. s. Click the Add button. o. FIGURE 1. Salesperson Commission. Click OK to close the Tablix Properties window. Save and compile the report.51 . x. Exit Visual Studio. w. y. Load the changes. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 .Module 1: Creating Reports v. Mort is mainly responsible for fixing problems and implementing features and customizations in the internal IT applications. the Sales Manager. Objectives The purpose of this lab is to create a RoleTailored client report with a table layout from scratch. The list also needs to contain a grand total for all salespersons. you will add some additional functionality to the report. Your task is to build the report for the RoleTailored client. from scratch. 1 . a customization developer in the Information Technology (IT) Department.Reporting in Microsoft Dynamics® NAV 2013 Lab 1. • Total sales (LCY) and total profit (LCY) by document type. Only a draft version of the object exists. containing the correct data model and two sections. Exercise 1: Create the Report Exercise Scenario Build a report showing the following.1: Creating a Table Report Scenario Your company has implemented Microsoft Dynamics NAV 2013 and some additional reports need to be created. In the next modules. by country/region code. by country/region code and by salesperson • Subtotals for each group • Grand total for all salespersons Dates and totals in the report must be formatted as defined in Microsoft Dynamics NAV. Throughout the labs. The report is not finished yet. You will learn how to add formatting to specific fields. and will add grouping and totaling. by customer no. by customer and by document type. has asked for an overview of the customer sales and profit (in local currency) by salesperson. The list needs to contain totals by salesperson. you will be assigned the role of Mort.. Kevin.52 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Open the CRONUS International Ltd. verify that the action is set to Create. If not.Module 1: Creating Reports Task 1: Import Report 123456700 High Level Steps 1. c. In the Action column. In the dialog box. Click Open to import the object in the database. use the following procedure. Detailed Steps 1. Click OK to start the import. a. Layout to open Microsoft Visual Studio. choose to open the Import Worksheet window. Task 3: Add a Table to the Report High Level Steps 1. f. Import. Next. To import the object in the demonstration database.L1. Visual Studio will open and show a blank Report Layout.53 . b. First. use the following procedure. open report 123456700. h. b.1 in design mode. The Toolbox window is normally displayed on the left side of the Visual Studio IDE. add some controls from the Toolbox window to the Report Layout window. Open the Microsoft Dynamics NAV 2013 demonstration database. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . Task 2: Open the Object in Visual Studio High Level Steps 1. demonstration company. c. Select Tools. a. e. start the Visual Studio development environment to create the RDLC report layout. In the Object Designer. d. First. it can be made visible by pressing Ctrl+Alt+X. Sales by Salesperson . Detailed Steps 1. g. To import the object in the demonstration database. i. Select File. start the Visual Studio development environment to create the RDLC report layout. Select View. Object Designer to open the Object Designer.fob. Browse to the report R123456700. Task 5: Add Dataset Elements to the Table High Level Steps 1. The following steps show how to add additional columns to the table. data) and three columns. Next. Detailed Steps 1. Drag the selected element to a cell in the detail row of the table. If not. Select any cell in the table. click the Table control. b. b. In the Toolbox window. 1 . (You can also drag the Table control to the Body section. it can be made visible by pressing Ctrl+Alt+X." A new column will be added to the table.Reporting in Microsoft Dynamics® NAV 2013 Detailed Steps 1. Detailed Steps 1. a. The new column will have the same width as the selected column. c. c. select Customer__Salesperson_Code_. Right-click the column handle above the third column and select "Insert column to the right. select an item from the dataset. In this case drag it to the first column in the Detail row. b. The column handle can be used to select and/or resize a column. The following steps show how to add additional columns to the table. The following steps show how to add dataset elements to the table. In the Report Data window. The following steps show how to add dataset elements to the table. As a result. The Toolbox window is normally displayed on the left side of the Visual Studio IDE. a.) The report now contains a table with two rows (header. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Now a grey bar is displayed above each column: the column handle. For example. The dataset is generated based on the report dataset designer. Repeat steps 1 and 2 three times.54 The dataset is generated based on the report dataset designer. the table will have two rows and seven columns. Task 4: Add Columns to the Table High Level Steps 1. Select the Customer__Country_Region_Code_ and drag it to the second column on the Detail row. a. Click in the Body section to add a table to the report. add some controls from the Toolbox window to the Report Layout window. b. Select the Cust__Ledger_Entry__Sales__LCY__ and drag it to the sixth column on the Detail row. Select the Cust__Ledger_Entry__Document_Type_ and drag it to the fourth column on the Detail row. Select the Cust__Ledger_Entry__Profit__LCY__ and drag it to the seventh column on the Detail row. Click Yes to save the object. Select the Cust__Ledger_Entry__Customer_No__ and drag it to the third column on the Detail row. Task 6: Run the Report High Level Steps 1. To check the layout of the report. h. The following dialog box will be displayed. a. Save and close Visual Studio. i. and the previous RDLC layout will be retained. Press Esc to leave the Report Designer. run the report. You will be redirected to the Report Designer. To check the layout of the report. all changes made in the previous steps will be discarded.25: MICROSOFT DYNAMICS NAV DIALOG BOX j. The result will appear similar to the following image : Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . select the report and click Run. f. FIGURE 1.Module 1: Creating Reports d.55 . Detailed Steps 1. run the report. The RoleTailored client will be started and the request page of the report will be displayed. Click Yes to load the RDLC layout in the report object. Click the Preview button to run the report. Select the Cust__Ledger_Entry__Posting_Date_ and drag it to the fifth column on the Detail row.) k. (If you select No. e. g. In the Object Designer. c. Right-click the cell and select Placeholder Properties. To reflect the same formatting in the RoleTailored client. to reflect the same formatting in the RoleTailored client. you will need to change the formatting of the Sales (LCY) and Profit (LCY) fields in the report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . you will need to change the formatting of the Sales (LCY) and Profit (LCY) fields in the report.26: SALES REPORT PREVIEW WINDOW Task 7: Add Currency Formatting to the Report High Level Steps 1. Open report 123456700 in Visual Studio. In the Print Preview notice. some of the fields that show amounts (decimal values) are not formatted correctly—some have decimals— some do not.56 In the Print Preview notice. Detailed Steps 1.Reporting in Microsoft Dynamics® NAV 2013 FIGURE 1. some of the fields that show amounts (decimal values) are not formatted correctly—some have decimals— some do not. Select the Sales (LCY) field in the detail row. b. a. 1 . Select the Custom option in the Category column. there are two options to define a format: by using a format. or by using an expression. Click the [Fx] button next to the Custom Format field.57 . The result will appear similar to the following image. you can either select a standard format. Double-click the Cust__Ledger_Entry__Sales__LCY__Format element in the Fields (DataSet_Result) category. Click OK to close the Expression window. Select the Number tab. If a format is being used. f.Module 1: Creating Reports d. j. or build your own custom format. From previous steps. you want to use the same formatting that is defined in the G/L Setup window. import the new RDLC layout in the object. However. k. save the object and run it. you know that the dataset also contains special formatting elements for decimal fields.27: SALES REPORT PREVIEW WINDOW Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . g. On this tab. Repeat steps 2 through 9 to format the Profit (LCY) field using the Cust__Ledger_Entry__Profit__LCY__Format element. h. i. Click OK to close the Placeholder Properties window. These elements can only be selected using an expression. e. Save and Exit Visual Studio. FIGURE 1. The Expression window is displayed. d.". b. e. The language can be defined using the Language property of the report. you can use either a specific value (that applies for all users in all cases) or use an expression to make it user-dependent. make sure Report is selected in the drop-down list. the decimal separator is ". Note that the default value is set to "=User!Language" which explains the current decimal and thousand separator. you can use either a specific value (that applies for all users in all cases) or use an expression to make it user-dependent." while the thousand separator is ". By default. Both separators are not defined hardcoded. Both separators are not defined hardcoded. save the object and run it. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . import the new RDLC layout in the object. As with decimal formatting. c. a. Select the Language property." while the thousand separator is ".Reporting in Microsoft Dynamics® NAV 2013 Task 8: Decimal and Thousand Separators High Level Steps 1.58 By default. 1 . Open the report in Visual Studio.". The result will appear similar to the following image. they depend on the language of the report. In the Properties window. they depend on the language of the report. Detailed Steps 1. The language can be defined using the Language property of the report. Save and Exit Visual Studio. As with decimal formatting. the decimal separator is ". Detailed Steps 1. 0. Save and compile the report in the Report Designer. Open the report in the Report Dataset Designer.28: SALES REPORT WITH SEPERATORS PREVIEW WINDOW Task 9: Add Date Formatting to the Report High Level Steps 1. 2.2>-<Year4>') d. You can also define the date format in Visual Studio. Notice that all posting dates are formatted as defined in the report. In the Print Preview notice that has the dates in the report still displayed as a Date Time field.Module 1: Creating Reports FIGURE 1. set the SourceExpr property to: FORMAT("Cust."Posting Date". Select the line containing the Posting Date field and select Properties. Perform the following steps to add date formatting. c. b. perform the following steps. To have the date formatted as MM-DD-YYYY. Run the RoleTailored client report. Ledger Entry". Perform the following steps to add date formatting.59 . In the Print Preview notice that has the dates in the report still displayed as a Date Time field. a. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 .2><Month. you will need to change the formatting of the Posting Date field. you will need to change the formatting of the Posting Date field. In the Properties window. '<Day. The column and row handles appear. Select any cell in the table."Posting Date". enter MM-dd-yyyy. In the Category. Detailed Steps 1. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . (Remove the format instruction entered earlier. Click OK to close the Textbox Properties window. Notice that all posting dates are formatted as defined in the report. b. The specified date format will be copied to the Format code field in the Textbox Properties window. 3. 2. a. right-click the text box containing the Posting Date field and select Textbox Properties. Delete the detail columns that were added as groups. perform the following steps. Select the detail row by clicking the row handle. field. Open the report in the Report Designer. b. Open the object in the RDLC design mode. You can also define the date format in Visual Studio. d. click the Number tab.60 Add a grouping to the table. Add a grouping to the table. set the SourceExpr property to "Cust. Right-click the row handle for the detail row and select Add group.) d. Date formats specified in the Report Dataset Designer will not overrule any format defined in Visual Studio. In the Textbox Properties window. j. In the text box. Task 10: Add Grouping to a Report High Level Steps 1. 4. Save and Exit Visual Studio. i. Add a new grouping for the Country/Region Code field. 5.Ledger. a. Parent Group. On the detail row. Open the report in Visual Studio. e.Reporting in Microsoft Dynamics® NAV 2013 2. To have the date formatted as MM-DD-YYYY. select the Custom option. f. Add a new grouping for the Customer No. 1 . c. c. g. h. Run the RoleTailored client report. Add a new grouping for the Document Type field. Select the line containing the Posting Date field and select Properties. In the Properties window. The dates are now formatted according to the specified formula.Entry". Click the Group2 drop-down list in the Row Groups window. 2. select the [Cust__Ledger_Entry__Document_Type_] element. b. c. Add a new grouping for the Document Type field. e. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . Child Group. Child Group. g. Click OK to close the Grouping Properties window. select the [Customer__No__] element. b. Notice that two new rows are added to the table: a group header row (above the detail row) and a group footer row (below the detail row). Select the check boxes: Add group header and Add group footer. 3. Click the Group3 drop-down list in the Row Groups window. select the [Customer__Salesperson_Code_] element. c. 4. Select the check boxes: Add group header and Add group footer. Select Add group. Also notice that at the bottom of the screen. Group1 and Details are listed in the Row Groups window. select the [Customer__Country_Region_Code_] element. c. Select Add group. Child Group. Select the check boxes: Add group header and Add group footer. Also notice that a Group3 is added below Group2 in the Row Groups window. field. Notice that two new rows are added to the table: a group header row (above the detail row) and a group footer row (below the detail row). In the Group by list box. Notice two new rows are added to the table: a group header row (above the detail row) and a group footer row (below the detail row). Select Add group. d. Click the Group1 drop-down list in the Row Groups window. In the Group by list box.61 . Click OK to close the Grouping Properties window. d. a. b. e. Add a new grouping for the Customer No. In the Group by list box. f. In the Group by list box. Add a new grouping for the Country/Region Code field.Module 1: Creating Reports e. a. a. Also notice that a Group2 is added below Group1 in the Row Groups window. Click OK to close the Grouping Properties window. The result will appear similar to the following image. Save and Exit Visual Studio. c. a. FIGURE 1. e.29: SALES REPORT WITH DATE FORMATTING PREVIEW WINDOW 1 . Repeat the last to steps for the column that contains the Country Region Code field (column 6).62 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Reporting in Microsoft Dynamics® NAV 2013 5. Click OK to close the Grouping Properties window. b. Delete the detail columns that were added as groups. d. e. Also notice that a Group4 is added below Group3 in the Row Groups window. Notice that two new rows are added to the table: a group header row (above the detail row) and a group footer row (below the detail row). Select the check boxes: Add group header and Add group footer. save the object and run it. Right click the column header and select Delete. import the new RDLC layout in the object. Since we have added the Salesperson Code and Country Region Code as groups they are no longer required at the detail level of the report. d. Select the column header containing the Salesperson Code fields at the detail level (column 5). Right-click in the text box of the sixth column on the group footer row for the Country/Region Code group. Detailed Steps 1. g.Value). f. Save and Exit Visual Studio. In the Expression Editor that opens. Right-click in the text box of the seventh column on the group footer row for the Country/Region Code group. The following steps show how to add totaling to a report. The following steps show how to add totaling to a report. e.Module 1: Creating Reports Task 11: Add Subtotals to a Report High Level Steps 1. b. type: =Sum(Fields!Cust__Ledger_Entry__Profit__LCY__. Specify the correct format for the subtotal. d. c. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . Select Expression in the drop-down list that appears. a. import the new RDLC layout in the object. type: =Sum(Fields!Cust__Ledger_Entry__Sales__LCY__.63 . save the object and run it. Specify the correct format for the subtotal. In the Expression Editor that opens. j. i. Open the object in the RDLC design mode. Select Expression in the drop-down list that appears. h.Value). b. Select Expression in the drop-down list that appears.Reporting in Microsoft Dynamics® NAV 2013 The result will appear similar to the following image. Detailed Steps 1. import the new RDLC layout in the object.64 The following steps show how to add grand totals to a report. Right-click in the text box of the sixth column on the table footer row. In the Expression Editor that opens. g. Save and Exit Visual Studio. type: =Sum(Fields!Cust__Ledger_Entry__Sales__LCY__.30: SALES REPORT WITH SUBTOTALS PREVIEW WINDOW Task 12: Add Grand Totals to a Report High Level Steps 1. FIGURE 1. save the object and run it. f. c. Open the object in the RDLC design mode. Repeat steps 2 through 5 for the Cust__Ledger_Entry__Profit__LCY__ field. The following steps show how to add grand totals to a report. 1 . e. Specify the correct format for the grand total.Value). a. d. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In the next module you will further enhance the layout and fine-tune the report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 .65 .Module 1: Creating Reports The result will appear similar to the following image.31: SALES REPORT WITH GRAND TOTALS PREVIEW WINDOW The layout at the current state of development is not user friendly. FIGURE 1. You will learn how to add formatting to specific fields. Ellen asks Mort to build a report showing the item inventory by location. and how to add grouping and totaling. namely report R123456701. d. In the next modules. Objectives The purpose of this lab is to create a RoleTailored client report with a matrix layout from scratch. Browse to the report R123456701. Exercise Scenario Build a matrix report for report 123456701 showing the total Inventory by Location Code.Reporting in Microsoft Dynamics® NAV 2013 Lab 1. 1 . Item numbers need to be printed as black text on an orange background. use the following procedure. and one of her tasks is to optimize the entire warehouse. Task 1: Import Report 123456701 High Level Steps 1. Select File. She ensures that item inventory levels are accurate and that periodic physical inventory counts occur. a. Open the CRONUS International Ltd. Detailed Steps 1. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Import. f.2: Creating a Matrix Report Scenario Ellen is the Warehouse Manager. The classic layout is available as a separate object on the training DVD. Exercise 1: Build a Matrix Report. Select Tools. c. e. To import the object in the demonstration database. Use this as a starting point.fob. you will add some additional functionality to the report. Open the Microsoft Dynamics NAV 2013 demonstration database. demonstration company.66 To import the object in the demonstration database. Object Designer to open the Object Designer. Location codes need to be printed as bold white text on a dark blue background. b. use the following procedure. Click OK to start the import. In the dialog box. a. i. Click in the Body section to add a matrix to the report. In the Action column. The first thing to do is to start the Visual Studio development environment to create the RDLC report layout of the report. Click OK to import the object in the database. The position of the control can be changed either by dragging the control to the correct position or by changing the control properties. click the Matrix control. When you place a matrix control on the Body section. Item Matrix L1. verify that the action is set to Create. The first thing to do is to start the Visual Studio development environment to create the RDLC report layout of the report. b. Select View. open report 123456701. In the Toolbox window. h. Layout to open Microsoft Visual Studio. To add the Matrix to the report follow these steps. To add the Matrix to the report follow these steps.67 . Task 4: Change the Position of the Matrix Control High Level Steps 1. Detailed Steps 1. b. Detailed Steps 1. a.Module 1: Creating Reports g.2 in design mode. it might not have the correct position. The report now contains a matrix with two rows and two columns. (You can also drag the Matrix control to the Body section). choose to open the Import Worksheet window. Task 2: Open the Object in Visual Studio High Level Steps 1. Visual Studio will open and show a blank Report Layout. Task 3: Add a Matrix Control to the Report High Level Steps 1. In the Object Designer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . 1 . In the Properties window. Detailed Steps 1. you can change the position of the control by changing the properties of the matrix.68 In the dataset. Use the size handles to drag the control to the desired position (by preference in the top left corner). Press Esc. The position of the control can be changed either by dragging the control to the correct position or by changing the control properties.32: REPORT LAYOUT WINDOW Task 5: Add Dataset Elements for the Items to the Matrix High Level Steps 1.) FIGURE 1.Reporting in Microsoft Dynamics® NAV 2013 Detailed Steps 1. Select any cell in the matrix. To add Dataset Elements for the Items to the Matrix. select the matrix1 control. a. b. To add Dataset Elements for the Items to the Matrix. c. When you place a matrix control on the Body section. select the Item__No__ element and drag it to the first cell on the second row of the matrix control. The size handles (white blocks) will appear. Eventually you can resize the control. a. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . The properties for the matrix will be displayed (and the matrix control will be selected. it might not have the correct position. As an alternative for step 3. d. In the Properties window. Detailed Steps 1. To add Dataset Elements for the Locations to the Matrix. set the BackgroundColor property to Dark Blue. g. save the object and run it. b. f. field. In the Properties window. select the Item_Ledger_Entry_Quantity element and drag it to the second cell on the second row of the matrix control.Module 1: Creating Reports Task 6: Add Dataset Elements for the Locations to the Matrix High Level Steps 1. a. set the FontWeight property to Bold. set the Color property to White. a. h. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . c. Top. Bottom and Default properties to Solid. in the BorderStyle property collection. To add Formatting to the Matrix. In the dataset. select the Item_Ledger_Entry__Location_Code_ element and drag it to the second cell on the first row of the matrix control. To add Totals to the Matrix. Detailed Steps 1. In the dataset. Select the text box containing the Item No. set the BackgroundColor property to Orange. To add Formatting to the Matrix. i. In the Properties window.69 . To add Totals to the Matrix. Select the text box containing the Location Code field. Save and Exit Visual Studio. In the Properties window. Task 7: Add Totals to the Matrix High Level Steps 1. To add Dataset Elements for the Locations to the Matrix. In the Properties window. e. Detailed Steps 1. Task 8: Add Formatting to the Matrix High Level Steps 1. Right. set the Left. import the new RDLC layout in the object. a. Select the text box containing the Quantity field. FIGURE 1.70 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .33: MATRIX REPORT PREVIEW WINDOW 1 .Reporting in Microsoft Dynamics® NAV 2013 The result will appear similar to the following image. use the following procedure.3: Adding a Chart Scenario As a Project Manager. Prakash asks Mort to present the figures in the report by means of a chart. Import. Finally. To import the object in the demonstration database. Exercise 1: Adding a Chart to an RDLC Report Layout. Select File. d.71 . To have an overall view that includes all jobs. b. Exercise Scenario Add a column chart to report 123456709. Open the CRONUS International Ltd. Open the Microsoft Dynamics NAV 2013 demonstration database. Browse to the report R123456709. a. Prakash is using report 1009. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . you will finetune the chart by adding some basic formatting.Module 1: Creating Reports Lab 1. c. To avoid destroying the original report. The chart needs to display the following pricing. • Total budgeted cost price (Light Coral) • Total realized cost price (Red) • Total budgeted sales price (Light Green) • Total realized sales price (Forest Green) Task 1: Import Report 123456709 High Level Steps 1. use the following procedure. Job Actual to Budget to compare the budgeted and the realized amounts of the different jobs. e. The chart will be based on variables from the dataset (instead of fields). Select Tools. To import the object in the demonstration database. which is a copy of the standard report 1009. Object Designer to open the Object Designer. Objectives The purpose of this lab is to add a chart to an RDLC report layout. Detailed Steps 1. demonstration company. Mort will start from report 123456709. g.Chart in design mode. it already has an RDLC layout. a. h. d. choose to open the Import Worksheet window. In the Toolbox window. b. i. Layout to open Microsoft Visual Studio. Set the Height property to 18 cm. Task 3: Add a Chart to the Report High Level Steps 1. Click OK to start the import. Since the report is a copy from the standard report 1009. Job Actual to Budget . Change the height of the Body section by changing its Height property (in the Size property collection). g. When you drag a field from the dataset over the Chart. The Select Chart Type window opens. open report 123456709. start designing the RDLC report layout. 1 . The following steps show how to add a chart to the report.72 The following steps show how to add a chart to the report. e. select No_Job and drag it to the Category area below of the chart. the areas will display. b. Select the Body section by clicking the right grey bar or by selecting the Body option in the Properties window. Detailed Steps 1. In the dialog box. Now. Task 2: Design Report 123456709 High Level Steps 1. Click OK to import the object in the database. In the Action column. i. Use the vertical scrollbar to visualize the bottom end of the Body section. In the Object Designer. Select View.Reporting in Microsoft Dynamics® NAV 2013 f. a. Detailed Steps 1. h. Click the Report Data window to display the dataset. Click the Body section to insert a Chart control. verify that the action is set to Create. In this window select the Ok button to add a 3D-Column chart to the Body of the report. start designing the RDLC report layout. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . select the Chart control. c. In the dataset. f. Now. Click OK to close the Properties window.Actual vs. a. d. Click OK to close the Properties window. However. In the dataset. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 .Module 1: Creating Reports j. in the Pick Color field: select Light Coral. n. 3. Select JobTotalAmt4 and drag it to the Data area. b. c. a. 12 pt. Detailed Steps 1. Change the size of the chart by changing its properties: set the Height property to 7 cm and set the Width property to 18 cm. On the Font tab format the title to Verdana. Now it is time to add some formatting to the report. Now. change the names in the legend. Add Visual Effects to the Chart. change the default colors of the columns and add some effects. The following steps show how to add a title to the chart. Add a chart title. Select JobTotalAmt5 and drag it to the Data area.73 . Right-click the Title control in the chart and select Title Properties. Add a chart title. 2. enter Job . the totals are displayed using variables. Set the Border and Fill Color to Red. 2. k. Right-click the field JobTotalAmt4 in the data fields at the top of the chart and select Series Properties. m. Select JobTotalAmt7 and drag it to the Data area. Next. add labels to clarify the elements shown on the X and Y axis of the chart. Bold and Red. On the Fill tab. Select JobTotalAmt8 and drag it to the Data area. you must select the variables that are used in the sections to display the job totals and drag them to the Data area of the Chart. change the default colors of the columns and add some effects. b. in this case. change the names in the legend. 4. The following steps show how to change the default colors of the columns. Budget. Now it is time to add some formatting to the report. o. The following steps show how to change the default colors of the columns. add the fields containing the job totals to the Data area. On the Title Text field. The following steps show how to add a title to the chart. l. Task 4: Add Formatting to the Chart High Level Steps 1. d. Repeat steps 1 through 3 for the JobTotalAmt5 value. c. Click OK to close the Chart Properties window. and to change the layout and the position of the legend. 4.74 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Set the Border and Fill Color to Forest Green. d. Click OK to close the Chart Properties window. you can choose to show or hide the legend. Change the Wall Thickness to 30 percent. g. Set the Border and Fill Color to Light Green. e. Repeat steps 1 through 3 for the JobTotalAmt7 value. Click OK to close the Chart Properties window. FIGURE 1. Change the Horizontal rotation to 5°. e. By checking the field. Right-click the chart control and select Chart Area Properties. f. Repeat steps 1 through 3 for the JobTotalAmt6 value.Reporting in Microsoft Dynamics® NAV 2013 3. f. Right-click the chart control and select Properties. a. On the Legend tab. On the 3-D Options tab. The result will appear similar to the following image. a. c. add labels to clarify the elements shown on the X and Y axis of the chart. save the object and run it. import the new RDLC layout in the object. save and exit Visual Studio. b. c. Change the Inclination to 15. b. the other options on the tab will be enabled. g.34: JOB ACTUAL TO BUDGET REPORT PREVIEW WINDOW 1 . check the enable 3D field. Now that the chart is finished. Now. Add Visual Effects to the Chart. c. Select File. This report shows amounts for sales.75 . To import the object in the demonstration database. for each salesperson for a selected period. Detailed Steps 1. As a best practice. that reflect any changes to the original costs of the items in the sales. has asked Mort to enhance the existing report Salesperson . payment discount. a. use the following procedure.Gauge • Add a gauge to the report • Add dataset elements to the gauge • Add formatting to the gauge Task 1: Import the Report High Level Steps 1. Select Tools. Open the CRONUS International Ltd.Module 1: Creating Reports Lab 1. the Sales Manager. and the profit percentage. Objectives The purpose of this lab is to introduce the Gauge control and learn how to add it to a report. Visualizing the information in this report more clearly will ensure that Susan will have a better understanding of the figures and their ratio.Sales Statistics. use the following procedure. profit.4: Using a Gauge Scenario Susan. Exercise 1: Adding a Gauge Control to a Report Exercise Scenario • Import report 123456710. Mort will make a copy of the existing report and make the changes to the new report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . Salesperson . Object Designer to open the Object Designer.Sales Statistics so that the information presented in the report is more visually clear. Open the Microsoft Dynamics NAV 2009 demonstration database. b. demonstration company. d. invoice discount. Import. To import the object in the demonstration database. The report also shows the adjusted profit and adjusted profit percentage. Click OK to import the object in the database. Now. Salesperson Sales Statistics. c. Task 3: Add a Gauge to the Report High Level Steps 1.76 The following steps show how to add a Gauge to the report. b. 1 . Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Gauge in design mode. Detailed Steps 1. right. Task 2: Design the Report High Level Steps 1. open report 123456710. Select the option: Insert column. In the dialog box. In the Action column. The following steps show how to add a Gauge to the report. choose to open the Import Worksheet window. g. This is the trigger of the report where the following values are calculated. d. The report dataset designer shows there are two data items: Salesperson/Purchaser and Cust.  SalesLCY  ProfitLCY  InvDiscLCY  PmtDiscGivenLCY  PmtToleranceLCY  AdjProfit c. select View. b. Now start designing the RDLC report layout. Browse to the report R123456710. In the C/AL code view of the report notice the code in the OnAfterGetRecord trigger of the Cust.Reporting in Microsoft Dynamics® NAV 2013 e. In the Object Designer. Select the last column of the Tablix and right-click. Data item. Ledger Entry. review how the existing report is developed. a. a. Since the report is a copy from the standard report 114. Click OK to start the import. A new column is now added to the Tablix. i. h. Detailed Steps 1. Now start designing the RDLC report layout. Before you continue. verify that the action is set to Create. Ledger Entry. it already has an RDLC layout. f. Layout to open Microsoft Visual Studio. k. A popup window opens displaying the Linear Pointer Properties. In the Properties window set the Size properties to the following values: Width: 3 cm. p. l. f. In the Data pane. From the toolbox. save the object and run it. Click OK. or drag it to the design surface into the selected cell. Click OK. next to the value field. right-click the Linear Pointer 1 box. =Code. save and exit Visual Studio. click the Fx button. In the Expression Designer window type the following expression. n. j. double-click the Gauge data region. e. Now select the cell in which the Gauge is added. In this window.Value). Fields!AdjProfit. Height: 1. r. in the newly created column.Value. Click the gauge to display the Data pane.Module 1: Creating Reports d. and in the drop-down menu that opens select Pointer properties. g. The Select a Gauge Type dialog box appears. import the new RDLC layout in the object.4 cm. o. q. Click OK. m.CalcPct(Fields!Cust__Ledger_Entry___Sales__LCY__. Now that the report is finished. Click and select the cell in the detail level of the tablix. Select the Bullet Graph gauge. h.77 . i. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . Reporting in Microsoft Dynamics® NAV 2013 The report should now appear similar to the following image.35: REPORT WITH GAUGE 1 . FIGURE 1.78 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . report execution. Which property can be set on a column to influence the name of the corresponding element in the dataset? ( ) DataSetName ( ) Name ( ) DataSetSourceExpr ( ) DataSetID 3. sorting and filtering data. 1. Which report items are not available in the Visual Studio Report Designer? ( ) Text box ( ) Chart ( ) Gauge ( ) Drop-down list 2. Test Your Knowledge Test your knowledge with the following questions. Additionally. dataset generation. the module discussed some of the most frequently used properties and functions. It also examined the integration between the Report Dataset Designer and the Visual Studio Report Designer in relation to report creation. What does RDL stand for? ( ) Report Dataset Language ( ) Report Definition Language ( ) Report Design Language ( ) Report Data Language Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 .Module 1: Creating Reports Module Review Module Review and Takeaways This module explained the architecture of Microsoft Dynamics NAV 2013 and the Visual Studio integrated development environment.79 . Which export formats are offered by the report viewer control? ( ) XML ( ) PDF ( ) Microsoft Office Excel ( ) HTML 5. Which data item properties are supported by the report designer in the Microsoft Dynamics NAV 2013 ? ( ) DataItemTableView ( ) DataItemLink ( ) NewPagePerRecord ( ) TotalFields 1 .Reporting in Microsoft Dynamics® NAV 2013 4.80 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Which report items are not available in the Visual Studio Report Designer? ( ) Text box ( ) Chart ( ) Gauge (√) Drop-down list 2.81 . Which export formats are offered by the report viewer control? ( ) XML (√) PDF ( ) Microsoft Office Excel ( ) HTML Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 1 . Which property can be set on a column to influence the name of the corresponding element in the dataset? ( ) DataSetName (√) Name ( ) DataSetSourceExpr ( ) DataSetID 3. What does RDL stand for? ( ) Report Dataset Language (√) Report Definition Language ( ) Report Design Language ( ) Report Data Language 4.Module 1: Creating Reports Test Your Knowledge Solutions Module Review and Takeaways 1. Reporting in Microsoft Dynamics® NAV 2013 5.82 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Which data item properties are supported by the report designer in the Microsoft Dynamics NAV 2013 ? (√) DataItemTableView ( ) DataItemLink ( ) NewPagePerRecord ( ) TotalFields 1 . which acts like a table of contents. reports can include a variety of features that provide interactivity to users. how to use images and how to add extra navigation features such as a document map. the images. This module will explain some of the interactive features for the reports in Dynamics NAV.MODULE 2: INTERACTIVE FEATURES Module Overview The previous module introduced the new architecture of Microsoft Dynamics® NAV 2013 and it also provided a detailed explanation for the anatomy of a report. built-in collections. Users can influence the appearance of a report and the data it contains by typing or selecting a value for a filter before running the report. You can build conditional expressions using any feature supported by expressions. the expressions. A user can click items in the document map to jump to areas within a report. Formatting the items in your report makes the report look more attractive and enhances its readability. and custom code. and the data while in design mode. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2-1 . You also learned how to create a basic report. Visual Studio Report Designer also provides a document map. You will learn to work with different types of headers and footers. You can design a report so that different styles are applied to report items or properties based on the data in the report. in this module you will discover the interactive features from the new solution. In environments that support interactivity. webpages and pages. The previous module introduced the new reporting solution. how to define interactive sorting. including a built-in report and aggregate functions. A user can show or hide items in a report and click links that go to other reports. You can format the text boxes and individual items within the text boxes. Now you will learn more about the features that are offered in Reporting Services. how to apply visibility options. and you created a basic report and used the dataset to implement currency and date formatting. In addition. • Describe the visibility options for the reports and how to use them. • Explain interactive sorting and how to implement it. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . • Explain how document maps work and how to add them to a report. • Explain the difference between Print Preview and Print Layout.Reporting in Microsoft Dynamics® NAV 2013 Objectives The objectives are: 2-2 • Explain when to use headers and footers and how to add or delete a header or footer section. a body and page footer. but they are more commonly used to display varying content such as page numbers or information about the contents of a page. page headers and footers are not part of a report. capabilities and limitations of headers and footers. you can selectively hide it on the first and last pages of a report using the properties: PrintOnFirstPage and PrintOnLastPage. The page header and footer can contain static content. Headers and Footers The Report Definition Language for Clients applications (RDLC) 2008 specification supports three section types: a page header. After you create a page header or footer. borders. Typically. rectangles. No additional sections can be added. only the Body section is displayed. images. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2-3 . After you add a header or footer. design or delete these sections. They can also contain expressions. such as: • Report title • User who printed the report • Date and time information • Page number and or number of pages • Company logo A report can contain a page header and page footer that run along the top and bottom of each page. lines. background color. Page Header and Footer The page header is the first section that will print when a report is run. By default. and background images.Module 2: Interactive Features Working with Headers and Footers A report can have a header and a footer that will be visible at the top and bottom of all the pages. it is displayed on each report page. static text. a header contains some general information. A report can contain a header and footer that run along the top and bottom of each page. When you create a new report and open it in Visual Studio Report Designer. respectively. It is important to have a good understanding of the purpose. The Page Header and Page Footer sections must be manually added to the report. respectively. The next paragraphs explain how to add. select the control in the Toolbox. the information will be correct.Reporting in Microsoft Dynamics® NAV 2013 Note: If you add paging information to a header. the controls will not be added again automatically. or colors. To delete an existing page header or page footer section. Gauge or list) to a header or footer. Any controls that you previously added to the section will be deleted as well. chart. then click the header section to insert the control. background images. choose Remove Page Header or Remove Page Footer. If you add the header or footer section again. choose Remove Page Header or Remove Page Footer. you are deleting it from the report. You can add the following controls to a header and footer: • Text box • Line • Rectangle • Image You cannot add data region controls (table. By removing a header or footer section. Alternatively. If you print the report to a printer. only the body section will appear. and then from the menu. Delete a Page Header or Page Footer You can easily remove headers and footers by using the same toggle items that you use to add a header or footer. or to adjust the width of the header. right-click the corresponding section and select Properties. For more information. 2-4 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Headers and footers can be designed the same way as body sections. You can use the header or footer properties to add borders. you can right-click the page header or page footer section. To add a control to a header section. and then in the menu. Alternatively. To access the Header or Footer properties. Design a Header/Footer Section If no header or footer is defined for the report in Visual Studio. matrix. it might not always be correct when you run the report in preview mode. grab the control in the Visual Studio Toolbox and drag it to the header section. refer to the Print Preview and Print Layout section. select Report. especially if the report has a long body section. but you can change it if this is required. Change the design to fit your needs (you can include embedded images) and save the files. To do this. choose Page Header or Page Footer. The modified solution is used as a template for all new reports that are created from scratch in the Visual Studio Report Designer. This is the default location for the solution. open the solution that is installed under C:\Program Files\Microsoft Dynamics NAV\70\RoleTailored Client\ReportLayout.1: DELETE A PAGE HEADER OR FOOTER FROM THE DESIGN SURFACE AREA WINDOW A Default Page Header. Footer and Body Section for All Reports If you want to design a basic company layout for all reports. you can also delete a page header or footer section by right-clicking either the report selection menu or the design surface and then from the menu. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2-5 . FIGURE 2.Module 2: Interactive Features Finally. Note: Remember to copy the modified solution to all clients that will be used to design reports. you can change the standard Visual Studio solution template that is used as a base for all new reports. However. page footer. and import the RDLC data in the report. The ReportItems collection includes text boxes that are in the current scope of a page header. Instead an error message displayed “Error while validating RDL content: The Value expression for the textbox ‘X’ refers to a field. Then the ReportItems collection is used on the page header to retrieve the contents of the invisible text box in the Page Header section. you could not save the report in Report Designer. when the report body contains multiple tables. see module: Upgrade Reports of this course. the steps mentioned here are now obsolete. you could add a text box to a Page Header. another workaround is required. a scenario exists to work around this that can still be found in various standard reports. The RDLC 2008 specification now allows for data bound items to be placed in page headers and footers. the variable (and its contents) will move and be available. or report body. This scenario is no longer required in Microsoft Dynamics NAV 2013. “ Although this is a serious limitation. drag a field from the dataset to it. Although in design mode. 2-6 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Reporting in Microsoft Dynamics® NAV 2013 Data Fields in a Page Header and Page Footer The RDLC 2005 specification included a serious limitation: data fields could be not added to a Page Header or Footer. like in most document reports. For more information about the report upgrade process. a field from the dataset is added to the body section of the RDLC layout. The SetData function stores information in the global variable and the GetData retrieves information from the variable. The scenario made use of the ReportItems collection. As a result. Because tables might span several pages. The ReportItems built-in collection is the set of text boxes from report body. Fields cannot be used in page headers or footers. This makes use of a global variable that stores the data to be displayed in the page header and two functions: GetData and SetData. When you upgrade a report from Microsoft Dynamics NAV 2009 to Microsoft Dynamics NAV 2013 the scenario that is implemented in the ‘old’ report will be copied to the upgraded report. although it is no longer required. as a separate text box or as a table column. Typically. To do this. open it using the menu: Tools. you can use the following procedure to add the Page Header or Page Footer section.Module 2: Interactive Features Demonstration: Add a Page Header or Footer Demonstration Steps 1. Add Page Header. Select Reports in the Object Designer and Design report 123456700. Open the report in Visual Studio. select Add Page Header and/or Add Page Footer. from the menu. Object Designer. select Report. In the Report Dataset Designer select View. he adds a Page Header section to the report. they can be used both for adding and deleting the section. b. Layout to open Visual Studio. b. a. In this case. From the menu. To add a Page Header section. If the Object Designer isn’t already open. Mort has to add a report header to his reports. use report 123456700. Page Header and Page Footer are toggle items. 2. from the menu. c. d. In both menus. As an alternative solution. To add a Page Footer section. A header and/or footer will now be added to the report. select Report. Right-click either the report selection handle or the report design surface. Add Page Footer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2-7 . a. Additionally. You can add multiple tablix data regions to the body section. a data region such as a tablix is needed.2: A REPORT WITH A PAGE HEADER AND PAGE FOOTER WINDOW Table Header and Footer When you drag and drop a field from the Report Dataset onto the Report Body in Visual Studio Report Designer. Use the Tablix data region to display fields from a dataset either as detail data or as grouped data in a grid or free-form layout. There are three templates for a Tablix data region that you can add directly from the Toolbox: 2-8 • Table • Matrix • List Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . A tablix is a data region control. For a report to show multiple records from the dataset. FIGURE 2. Unlike a line or a rectangle. a tablix data region (and more in particular the detail row) is used to loop through the records and display data. As a result the report now contains a page header and footer. only the first value of the field in the text box is shown. a text box is automatically created. the detail row is designed only once and then repeated for all records in the recordset.Reporting in Microsoft Dynamics® NAV 2013 3. When you run the report. Row Type Table Header Description By default. When you add a table header and footer. the environment automatically adds “First” to it. It is a typical place to insert subtotals or grand totals. Tables can have multiple table headers. the table header will be inserted above all group headers and the table footer will appear after all group footers.3: HEADERS AND FOOTERS IN A TABLE CONTROL WINDOW Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2-9 . FIGURE 2. two new rows are added to the table (one immediately above the detail row. If you drag an item containing a numerical value from your dataset into a footer. If you drag an item containing text from your dataset into a header. Table Footer The table footer is printed once for each table. Table Details The detail row is used to display data from the dataset. and the report will print the total from the report. you can print any total you want. the environment automatically adds “Sum” to it. “First” means that it will show the first value in the dataset. and one immediately below).Module 2: Interactive Features A table can have three types of rows. It can be compared to the body section of the classic Section Designer. By combining table headers and footers with group header and footers. Tables can have multiple detail rows. Tables can have multiple footers. as opposed to looping through each record in the dataset. the table header is printed once for each table. These are the table header and the table footer rows. If group headers and or footers are defined for the table. This is a typical place to put captions. 1. By doing this. you can set the RepeatColumnHeaders in the Tablix Properties window. Demonstration Steps 1. 1. without having to define any keys (with SumIndexFields) or set sorting. select an element in the dataset and drag it to a cell in the table header or footer. Right-click the grey dotted table border and select Properties.Reporting in Microsoft Dynamics® NAV 2013 Design a Table Header or Table Footer To add data to a group header or footer. then press ESC. Delete a Table Header or Table Footer To delete a table header and the corresponding footer. To add a header row in a table: a. Visual Studio Report Designer will automatically add the Sum operator to the field value. Repeat Headers and Footers on New Pages In the Visual Studio Report Designer. b. the grand total for the table will display. (You can obtain the same result by setting a value for the Value property of the header or footer cell. If you add a decimal value to the header or footer. Select any cell in the table.10 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Right-click the row handle of the correct table header or footer. Click OK to apply the changes and close the Table Properties window. 2 . you can have totals calculated. Right-click the row handle and select Insert Row. grouping and totaling properties in Microsoft Dynamics NAV.) 2. Above/Below. Select a detail row in a table. you can obtain the same result by selecting the table control in the Properties window. 2. Only the selected row will be deleted. As a result. Demonstration: Add a Table Header or Footer Mort will add a table header and a table footer row to display the field captions. 3. Select Delete Rows. Set the RepeatColumnHeaders property. (If you want. Changing the Table Properties window will cause the properties of the underlying table and the individual table rows to change.) You can also take values from cells in other rows. follow these steps. 4. you can work with colors. you can also set the BackgroundColor and Color properties for multiple controls at the same time. When you export the report to Excel. CanShrink) and property collections (Font. BorderStyle. For example. so you can easily distinguish the logical structure of the report (everything between the two green rows is a logical group)." or you can add the name of the customer to a separate cell in the "Customer No. Colors in Headers and Footers Reports can be printed in color. You can use colors to emphasize specific pieces of data and also to reflect the structure of the content. or you can print a specific group header row (and the corresponding group footer) with a green background color. and so on) that can be defined for multiple controls at the same time (provided that the properties are common to all selected controls). Using Colors in Headers and Footers To fine-tune the layout and to acquire a better view on the contents of the report. In Visual Studio Report Designer. BorderColor. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . By default. You can define the colors for each individual control by setting the BackgroundColor and Color properties. The Page Header section will be put in one pane (and remain visible) while the body section will be put in another. the worksheet window in Excel will be split in multiple resizable panes." group header. the BackgroundColor property is set to Transparent and the Color is set to Black. Padding. The Color property defines the text color. it might be interesting to print extra "labels" explaining the data printed in the report. you can change the background and text color for all these controls by setting both properties.11 .Module 2: Interactive Features Freezing the Header Rows If you want the header rows to remain visible when scrolling in a report. Although additional texts can be a fixed text. an element from the dataset. next to each subtotal you can print text such as "Total for Customer 10000". Adding Texts to Headers and Footers As you work with headers and footers and subtotals on different levels. CanGrow. For example. or a combination of both. the BackgroundColor property determines the background color of the control. you can also define this in the Table Properties window. If you select multiple individual controls or an entire table row or column. In addition to the BackgroundColor and Color properties. you can have the Unit Price printed in blue and the Unit Cost in yellow. there are a number of other properties (TextAlign. its recommended to use Labels instead. BorderWidth. "Total for Country AT. and so on from a list. c. It is recommended to use the Expression window. b. By creating these labels in the Report Label Designer an advantage is the Multi Language functionality by using the CaptionML property of the label. Make sure not to delete the equal (=) sign. select the necessary cells. select the cell and change its Value property. It indicates that the cell value is an expression and not a fixed text. all text that you enter in the expression window will be displayed as plain text. only the equal (=) sign will be displayed. To print text in a specific cell. c. follow these steps. Right click and select: Merge Cells. Finally. a.>.12 To merge a cell. Remember that the width of the cell containing the text depends on the size of the column in the table detail row. If you remove the equal (=) sign. Open Report 123456700 in Visual Studio. because you can enter text and select variables. To enter custom text in the merged cell. If you want to split the cells. and select <Expression. To do this. Right-click the merged cell. Select the column header for the fifth row and right click. a. d. 2. Left. you can change the alignment of the texts by setting the individual cell properties. functions. In the Detail row of the table. If the cell is empty. merge the necessary cells (if necessary) then drag the Customer Name from the dataset to the right cell in the group header. Select Insert Column. right-click any of the selected cells and choose Merge Cells. b. select the two textboxes next to each other (on the fifth and sixth column).Reporting in Microsoft Dynamics® NAV 2013 These labels can be created in the Report Label Designer. f... e. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . To merge cells. follow these steps. right-click the merged cell and select Split Cell. you might have to merge the cells from the row before you insert the text. The Expression window will appear. 2 . Repeat the last two steps to insert another new column. In the drop-down list box the current cell value―if any―is displayed. Demonstration: Enter Custom Text in a Merged Cell If you want to include longer texts in a header or footer row. Demonstration Steps 1. Select the merged cell. You might also want to have the customer name printed next to the customer number. a. e. a. Demonstration: Add Labels to a Report The management of Cronus has asked Mort to modify the Inventory List report. Add a label for Total. e. In the Report Dataset Designer. Import report 123456711 Inventory – List2 and click Design. 3. h. d. f. Open the report and add the Inventory field to the dataset. and so on. and more. select the menu and open: View. If the text consists of multiple parts. c. 2.Module 2: Interactive Features d. b. e. dataset elements. Add the Inventory field and Total Label to the report. A column needs to be added that shows the Inventory Quantity and a total for this column must be added at the bottom of the list.13 . Fixed text should be placed between double quotes. d. To use a dataset element. you can now compose an expression consisting of fixed texts and/or variables. Add a new line in the Report Label Designer and in the column named Name type Total. In the Field Menu window select the Inventory Field and click the Ok button. The Visual Studio Report Designer opens. The Item. select the element in the corresponding category and doubleclick it. Open the Object Designer. Labels. function. Select the Include Caption for the newly added field. The Report Label Designer window opens. Demonstration Steps 1. Click OK to close the Expression window. In the drop-down list box. you can use the ampersand (&) to concatenate the parts. functions.Inventory field is added to the Report Dataset Designer. variable. In the column named Caption type Total. c. Select the Field Menu button. a. In the Report Dataset Designer add a new row at the end. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . b. The expression will be copied to the Value property. Close the Report Label Designer. Layout in the menu. g. b. The Field Menu window opens. Select View. The expression Designer window opens. right click the last column header and select Insert Column.4: ADD A ROW TOTAL AFTER WINDOW A new row is added to the table. After as shown in the next screenshot: FIGURE 2. d. l. In the properties of the field set the Format property to: =Fields!Inventory_ItemFormat. Right click the text box in the detail row of the last column and select: Expression. Close the Expression Editor window. In the Tablix.Value) m. g. Right. In the properties of the field set the Format property to: =Fields!Inventory_ItemFormat. In the last field of the last row enter the following expression: =Sum(Fields!Inventory_Item. open the expression editor and type the following expression: =Parameters!Inventory_ItemCaption. set the property FontWeight to Bold.Value 2 . In the Row Groups window.14 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Value h. select the Table1_Details_Group and click: Add Total. Type the following expression: =Fields!Inventory_Item.Value o. In the textbox to the left of the current textbox type the following expression: =Parameters!Total. j. A new column is now added to the table. In the properties of the field.Value i.Reporting in Microsoft Dynamics® NAV 2013 c. In the header row of the last column.Value k. e. n. f. Headers and footers can contain expressions. Scroll to the last page of the report. page headers and footers are not part of a report. rectangles. a. Expressions include dataset field references for reports with exactly one dataset and aggregate function calls that include the dataset as a scope. background color.Module 2: Interactive Features 4. set the property FontWeight to Bold. click Yes. Close the Report Dataset Designer and when you are asked to save. respectively.5: INVENTORY LIST REPORT WITH TOTAL WINDOW Report Header and Footer A report can contain a header and footer that run along the top and bottom of each page. Close the Visual Studio Report Designer. and background images. e. d. Select the report in the Object Designer and click Run. it is displayed on each report page.15 . Save and Run the report. c. click Yes. b. p. The result will look similar to this: FIGURE 2. After you create a page header or footer. q. When you are asked to save. borders. static text. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . Select the last row of the report and set the BackGroundColor property to: No Color. lines. In the properties of the field. images. By default. you can use groups to organize data on the report and/or to calculate aggregate summaries. Reports do not have a special report header or report footer area.16 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Reporting in Microsoft Dynamics® NAV 2013 The Report Header section generally contains the report title and other information you want to appear only at the beginning of the report. FIGURE 2. Report footer consists of report items that are placed at the bottom of the report body. at the beginning of the report. such as grand totals. They appear only once as the first content in the report. A report header consists of the report items that are placed at the top of the report body on the report design surface. Understanding how to define groups and use group features will help you design reports that are more concise and communicate summarized data in a more compact format. Objects placed in the Report Header section print once. This section is used to contain information you want to appear only once at the end of the report. Page headers and footers are not the same as report headers and footers. They appear only once as the last content in the report. For example charts and cross-tabs placed in this section contain data for the entire report. 2 .6: PAGE HEADER AND REPORT HEADER WINDOW Grouping Group Header and Footer In a report. The difference between a page header/footer and a report header/footer is illustrated in the following image. To help visualize what a group is. The Tablix data region includes a row group hierarchy and a column group hierarchy. the row groups categorize the dataset by city and salesperson and the column groups categorize the dataset by month and year.17 . Basically. the Grouping pane of the Tablix data region mentioned here is shown in the following figure.Module 2: Interactive Features A group can be considered as a named set of data from the dataset that is bound to a data region. The Grouping pane displays row group and column group members for the currently selected Tablix data region on the design surface. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . A group hierarchy has parent/child groups that are nested and can have adjacent groups.7: GROUPS IN A TABLIX DATA REGION WINDOW Groups are internally organized as members of one or more hierarchies. In this figure. a group organizes a view of the report dataset. the following figure shows the Tablix data region. Data associated with row group members expands horizontally across the page and data associated with column group members expands vertically down the page. FIGURE 2. All groups in a data region specify different views of the report dataset. For example. Demonstration: Add a Parent or Child Row or Column Group to a Tablix To group the data and display totals in the report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Demonstration Steps 1. After the data is grouped. confirm and click Design. or list. depending on where you position the row or column. you add groups to a data region when you want to display your data in a visual hierarchy.18 The following example shows how to add a tablix control in a report. An adjacent group appears at the same indent level as its sibling groups. Click View. child groups. When the data region renders in the report. you can specify whether to add the row or column inside or outside a group. b. Layout to open Visual Studio Report Designer. A child group appears indented under its parent group.fob.8: TABLIX GROUPING PANE The Row Groups pane and the Column Groups pane display a hierarchical view for all parent groups. you can sort the data within each group in ascending or descending order to make data easier to locate. matrix. When you add a row or column to a table. you can set properties that help keep the row or column with the group. Import report R123456714. Typically. align multiple data regions to show different views of the same data. a. and adjacent groups. Mort will use groups. c. Open the Object Designer. 2 . A row or column that is outside a group can serve as a group header or group footer.Reporting in Microsoft Dynamics® NAV 2013 FIGURE 2. or to calculate totals. [CurrencyCode_Customer] or click the expression button (fx) to create an expression.Module 2: Interactive Features d. Select the group properties of the newly added group.19 . Select report R123456714. Click View. In the Grouping pane.fob. To add an adjacent group to the report: a.for example. f.9: ADD ROW GROUP WINDOW Demonstration: Add an Adjacent Row or Column Group to a Tablix To group the sales data by product group and by territory. b. d. Drop the field above or below the group hierarchy using the guide bar to place the group as a parent group or a child group to an existing group. right-click a group that is a peer to the group that you want to add. Set the Name to CurrencyCode_Customer. c. e. and a sort expression that is based on the field name as shown in the following screenshot: FIGURE 2. The Tablix Group dialog box opens. Mort will add an adjacent group to the report. Layout to open Visual Studio Report Designer. Click OK. In Group by expression. select a field. group expression. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . Open the Object Designer. e. h. For example use the field City_Customer. click Design. The group is added with a default name. Demonstration Steps 1. g. and then click Adjacent Before or Adjacent After to specify where to add the group. Click Add Group. Drag a field from the Report Data pane to the Row Groups pane or the Column Groups pane. Demonstration: Edit a Row or Column Group in a Tablix Data Region Mort made an error when he added a group to the Tablix. Demonstration Steps 1. All expressions you specify are combined using a logical AND to specify data for this group. 2 . The Grouping pane displays the row and column groups.Reporting in Microsoft Dynamics® NAV 2013 The steps described here above are visualized in the following diagram: FIGURE 2. In Group expressions. On the report design surface. type or select a simple expression. Right-click the group and then click Group Properties. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .20 To edit the group settings: a. To correct it he will now edit the group settings. if you want to change it. d. type the name of the group.10: ADD ADJACENT GROUP WINDOW Mort has now added a new group to the Tablix data region on the design surface. g. c. e. Click Add to create additional expressions. or click the Expression (fx) button to create a group expression. (Optional) Click Page Breaks to set page break options. In Name. click anywhere in the Tablix data region to select it. (Optional) Click Sorting to select or type expressions that specify the sort order for values in the group. f. b. right-click the group. Demonstration Steps 1. Delete group only Choose this option to keep the structure of the Tablix data region the same and delete only the group definition. only the detail data rows are deleted. b. For the details group. Click OK. select one of the following options: c. In the Delete Group dialog box. The following example shows how to remove a Group from a Tablix control. (Optional) Click Filters to set filters for this group. Delete group and related rows and columns Choose this option to delete the group definition and all related rows that display group data. i. and then click Delete Group.21 . ii. (Optional) Click Variables to define variables that are scoped to this group and are accessible from any child groups. k. to remove a group.Module 2: Interactive Features h. Click OK. (Optional) Click Visibility to select the visibility options for the item. i. a. j. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . In the Grouping pane. if the same row belongs to both detail and group data. Demonstration: Delete a Group from a Tablix Mort is asked to modify the layout of an existing report. d.fob. point to Add Group. a. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .11: STEPPED REPORT WINDOW Traditional table reports place the parent group in an adjacent column on the report. as shown in the following example. or you can indent the detail rows. Open the Object Designer. b. Import report R123456715. FIGURE 2. 2 . Click anywhere in the table to select it. c. right-click the Details Group. In the Grouping Pane. To differentiate the group rows from the detail or child group rows. The new Tablix data region enables you to add a group and detail rows or child groups to the same column. Demonstration: Create a Stepped Report Demonstration Steps 1. confirm and click Design. you can apply formatting such as font color. Layout to open Visual Studio Report Designer.Reporting in Microsoft Dynamics® NAV 2013 Using a Stepped Report A stepped report shows detail rows or child groups indented under a parent group in the same column. The Grouping pane displays the Details group in the Row Groups pane. Click View.22 Add a parent group to your report. and then click Parent Group. e. Padding indents the text in the cell by the value you specify.Module 2: Interactive Features f. you do not need the first column that shows the group instance. Select the cell with the detail field that you want to indent. g. For a stepped report. change the padding of the detail data cell. When it is rendered. follow these steps a. Select Add group header. Click OK. The drop-down list displays the simple field expressions that are available in the Report Data pane. followed by a size designator. In this example it’s the textbox containing [No_Item]. h. d. Valid values for the Padding properties are zero or a positive number. and one or more columns with grouped detail data. such as . and click Delete. For Left.23 . Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . b. This option adds a static row above the group for the group label and group totals.5in. The default padding is b points. type a new padding value. In the Properties pane. you see one column with the group instance value. Change the expression of the first textbox on the first row to [@ServiceItemGroup_ItemCaption]. for example [ServiceItemGroup_Item]. You now have a basic tabular report. c. which is [ServiceItemGroup_Item]. type or select a group expression from the drop-down list. In the Tablix Group dialog box. expand the properties for Padding. The following figure shows what the data region might look like on the design surface. g. Paste [ServiceItemGroup_Item] in the first text box in the second row. To remove the group column. To indent the detail rows under the group header row in the same column. right-click the group column or cell. e. f. Instead. h. 2. Copy the value in the group header cell. FIGURE 2. select Data Item.13: DATA REGION FOR STEPPED REPORT LAYOUT The report displays the group with indented levels for the child group values. On the next row. The second data source is automatically indented under the first one. f. d. Click the Report button.24 To create the report a. This means that our report will be built on the basis of the Customer table the data from which will be retrieved and displayed at the top level of the report. type 21 to insert the Cust.Reporting in Microsoft Dynamics® NAV 2013 Size designators are: in Inches (1 inch = 2.54 centimeters) cm Centimeters mm Millimeters pt Points (1 point = 1/72 inch) pc Picas (1 pica = 12 points) Your data region will look similar to the following example. select the first line. This means that for each customer record. Demonstration Steps 1. Open the Object Designer. e. b. In the Report Dataset Designer. select Data Item. Ledger Entry table in the Data Source field. and in the Data Type field. Click New to create a new report. 2 . enter Customer (or type 18) in the Data Source field. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . in the Data Type field. Demonstration: Create a Report With Multiple Groupings Mort is aked to create a report to display customers and their transaction details. You can adjust the indent at any time by clicking the arrow left or arrow right button in the bottom right corner. c. the Customer Ledger Entry table will be looped through. j. On the next row. Click File. in the Data Type field. Entry table in the Data Source field. Save As and enter 123456710 for the report ID and CustomerDetails for the report name.14: REPORT DATASET DESIGNER WINDOW l. We need this data item to be indented under the Customer table (on the same level as the Cust. i. select Data Item option. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . Do not close the Report Dataset Designer. To correct the indentation. Ledg. enter 379 to insert the Detailed Cust. FIGURE 2. Ledger Entry table). On the next row. n. The third data source is automatically indented under the second one. Now the report structure should look as shown in the screenshot below.25 . use the arrow left and arrow right buttons in the bottom right corner of the designer. select Data Item option. h. k. type 36 to insert the Sales Header table in the Data Source field. m. Note that the third data source is automatically indented under the second one.Module 2: Interactive Features g. in the Data Type field. Click OK. a.15: DATA ITEM PROPERTIES WINDOW c.Reporting in Microsoft Dynamics® NAV 2013 2. Update the report data item properties. Change the data item properties as shown and close the Properties window to save the values. b. FIGURE 2. Ledger Entry data source. Select the first row with the Customer data source and press Shift+F4. 2 . Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .26 In the Report Dataset Designer. select the second row with the Cust. 16: DATAITEMTABLEVIEW WINDOW e. Ledger Entry data source.Module 2: Interactive Features d. select the third row with the Detailed Cust. FIGURE 2. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 .27 . Change the data item properties as shown and close the Properties window to save the values. In the Report Dataset Designer. 28 g. h. Change the data item properties as shown and close the Properties window to save the values.Reporting in Microsoft Dynamics® NAV 2013 f.17: DATA ITEM LINK WINDOW 2 . select the fourth row with the Sales Header data source. In the Report Dataset Designer. FIGURE 2. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Change the data item properties as shown and close the Properties window to save the values. Phone No.Module 2: Interactive Features FIGURE 2.19: ADD FIELDS FOR CUSTOMER WINDOW Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . b. and then click OK. Address.18: INDENTATION WINDOW 3. Add fields to the report. select the first row with the Customer data item and click View. In the Field Menu window. a. Field Menu. and E-Mail.. Click Yes on the confirmation message to add the selected fields to the Report Dataset Designer. c.. FIGURE 2. Name. In the Report Dataset Designer. select the following fields: No.29 . holding the Ctrl key. 20: FIELD NAME WINDOW e. Amount (LCY). Field Menu. Description. k. Document No. Entry Type. holding the Ctrl key. and Remaining Amt.. Ledger Entry data item and click View. and then click OK. Document Type. Journal Batch Name. Field Menu. Customer No.30 i. select the following fields: Entry No. Credit Amount (LCY)... (LCY). In the Field Menu window. Original Amt. Document No. Click Yes on the confirmation message to add the selected fields to the Report Dataset Designer. In the Report Dataset Designer. Amount. j. select the following fields: Entry No. holding the Ctrl key. The Name values in the Report Dataset designer must be short and Unique. Document Type... Change the values in the Name column as shown: FIGURE 2. Change the names of the added fields as shown: FIGURE 2. h.. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Click Yes on the confirmation message to add the selected fields to the Report Dataset Designer. Posting Date. f. Currency Code.21: CHANGED FIELD NAMES WINDOW 2 . Ledger Entry data item and click View. and then click OK.Reporting in Microsoft Dynamics® NAV 2013 d. g. (LCY). select the row with the Cust. In the Field Menu window. In the Report Dataset Designer. Debit Amount (LCY). Posting Date. Transaction No. select the row with the Detailed Cust. Module 2: Interactive Features l. Change the values in the Name column as shown: FIGURE 2.22: UPDATED FIELD NAMES WINDOW m. In the Report Dataset Designer, select the row with the Sales Header data item and click View, Field Menu. n. In the Field Menu window, holding the Ctrl key, select the following fields: Document Type, No., Posting Date, Prices Including VAT, and Amount, and then click OK. o. Click Yes on the confirmation message to add the selected fields to the Report Dataset Designer. p. Change the values in the Name column as shown: FIGURE 2.23: CHANGE FIELD NAMES WINDOW q. For each created row of the Column type, press Shift+F4 and, in the Properties window, set the IncludeCaption property to Yes. Press Ctrl+S to save the report and click OK on the confirmation message. Do not close the Report Dataset Designer. 4. Add labels to the report. a. Click View, Labels. b. In the Report Label Designer window, enter the following two labels and their captions: Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 - 31 Reporting in Microsoft Dynamics® NAV 2013 FIGURE 2.24: LABEL DESINGER WINDOW c. Close the Report Label Designer window. d. Close the Report Dataset Designer window and click Yes on the confirmation message to save changes. e. Run the Report. f. Observe the request page of the report. FIGURE 2.25: REQUEST PAGE WINDOW g. 2 - 32 The request page contains only one Customer filter tab with the possibility to add other filters from the Customer table. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 2: Interactive Features If you click Preview, the report will display a blank page because there is no layout for the report created yet. 5. Arrange the list of tasks the report should perform. a. Functional requirements: i. For each customer, the report should show the list of ledger entries and for each ledger entry, the report should show the list of detailed ledger entries. ii. After the ledger entries, the report should list the sales document headers for this customer with the basic information. iii. A check mark in the Show Customer Details field should enable the functionality of displaying the customer’s contact details next to the customer number and name. iv. Each section of data for a single customer should begin on a new page. v. Report should display the current filters, company name, and company logo in the header on every page. vi. The Amount field from the Cust. Ledger Entry table should be totaled for each customer. b. Design requirements: vii. Report should have a landscape orientation. viii. The Options tab with a Show Customer Details check box must be added on the request page to toggle the level of transaction detail to display. ix. The report should skip the data sections if there are no records to display (for example, no sales documents for a customer). x. The report layout should change depending on the value in the Show Customer Details check box on the request page. xi. A ShowCustomerDetails variable must be added and passed to the RDLC data set. xii. Amount fields must not display zero values. 6. Create the basic RDLC layout. a. Open report 123456710 in design mode. b. In the menu bar, click View, Layout. c. The RDLC report layout is displayed in Microsoft Visual Studio. The layout is blank. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 - 33 Reporting in Microsoft Dynamics® NAV 2013 d. Enable the report header by right-clicking anywhere outside of the report (in the grey area) and then clicking Add Page Header in the context menu. e. Set up a landscape orientation of the report and define the size of the visible area. f. Right-click anywhere outside of the report (in the grey area) and then click Report Properties. g. In the Report Properties window, on the Page Setup tab, in the Paper size section, select the Landscape orientation icon. Note, that the Width and Height properties will be changed accordingly. h. Click OK to close the Report Properties window. i. Place a list into the body section to group the report data. j. Click View, Toolbox (if not already shown). In the left-most corner next to the report, click the Toolbox tab to display the Toolbox pane, and then select the List control. k. Click the Body section of the report to place the List control into this section to store all the report data. l. Move the control to the top of the section and resize it to cover the whole page width. m. Change the background color for the control to make it visible (for the development time only): n. Right-click somewhere in the middle of the List control, and then click Rectangle Properties. o. In the Rectangle Properties window, browse to the Fill section. p. Set the Fill color property to an arbitrary color and click OK. FIGURE 2.26: ARBITRARY COLOR WINDOW Changing colors of all report elements will help you to identify them on the report preview. It is recommended to set different color properties for table header and detail rows, text boxes, and so on. 2 - 34 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 2: Interactive Features 7. Set up the list properties. a. In the inserted list, right-click on the selected row (the shaded border to the left of the selected row) and then click Tablix Properties. b. On the General tab, fill in the Dataset name field with DataSet_Result and click OK to close the Tablix Properties window. c. In the inserted list, right-click on the shaded border of the selected row again and then click Row Group, Group Properties. d. On the General tab, under Group expressions, click Add, click the drop-down arrow next to the Group on, and select the [Cust_No_] value to set up grouping of data by customer number. e. On the Page Breaks tab, select the Between each instance of a group page break option and click OK to close the window. f. Insert a table to store the customer data (customer number, name, address, phone number, and email). g. Since this table must display one customer at a time, all customer fields must be put into table header rows; the table data and footer rows must be disabled. h. In the Toolbox pane, click the Table control and drag the table to place it inside the list. i. Shrink the table to about half the list width. FIGURE 2.27: TABLE DATA REGION WINDOW j. Select any table row, right-click the shaded border and then click Tablix Properties. On the General tab, ensure that the Dataset name field is populated with DataSet_Result and then click OK. k. Right-click any column header and then click Insert Column, and select either Left or Right option to have four columns in the table. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 - 35 Reporting in Microsoft Dynamics® NAV 2013 l. Select the second table row, which is the Data row. Right-click on the selected row and then click Delete Rows to delete the table details row. m. Click OK on the confirmation message to delete the row and its associated groups. Disable the table footer in a similar way (if present). n. Select the only table row left, right-click on the shaded border to the left side of it and then click Insert Row, Below to insert another table header row. o. Repeat this action to have three table header rows in the table. p. Right-click the first cell in the table, and then click Expression. In the Set Expression area, enter the following expression in the text box: =Parameters!Cust_No_Caption.Value and click OK to close the window. q. Do the same for the cell below this one, and assign the =Parameters!NameCaption.Value value to the cell. r. Ensure that the values of all caption fields begin with =Parameters. You can select caption values from the Parameters category. FIGURE 2.28: PARMETERS NAME CAPTION VALUE WINDOW s. 2 - 36 Place the values of the No. and Name fields of the Customer table in the second table column, next to their respective captions, by selecting the fields from the Fields (DataSet_Result) category. Ensure that the values of all fields begin with =Fields. The expressions should be =Fields!Cust_No_.Value and =Fields!Name.Value for the No. and Name fields respectively. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 2: Interactive Features FIGURE 2.29: CUSTOMER NO WINDOW t. Place the values which represent the captions of the Address, Phone No., and E-Mail fields of the Customer table into the third table column. u. Place the values of the Address, Phone No., and E-Mail fields of the Customer table into the fourth table column, next to their respective captions. v. Ensure the values of fields do not contain any additional operators, such as Sum to avoid unnecessary calculations. w. The Sum function may be inserted into a field value automatically by the program if the data set name for a list control is empty. x. Select all table rows (not the table itself). Click View, Properties to open the Properties window if not already shown in the right bottom corner of the Visual Studio Report designer. y. Locate the BackgroundColor property and set it to an arbitrary color. FIGURE 2.30: BACKGROUNDCOLOR WINDOW z. In the menu bar, click Build, Build Web Site. aa. Inspect the Output pane and ensure that there are no errors. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 - 37 Reporting in Microsoft Dynamics® NAV 2013 It is a good practice to use the Build Web Site function periodically during the report design to ensure there are no errors or receive detailed information about report design issues if any. 8. Insert a new table. a. Insert another table to store the customer ledger entries and detailed ledger entries. Place the table below the one created previously. b. Select the table, right-click the shaded border and then click Tablix Properties. c. On the General tab, ensure that the Data set name field is populated with DataSet_Result and then click OK. d. Select and right-click the table Data row, and then select Insert Row, Outside Group – Below. e. Insert a parent group to store the customer ledger entry field captions and values. f. Select and delete the first row of the table. g. Add columns to the table so that the total number of columns is eleven. h. Click the table Data row, right-click the shaded border to the left and then click Add Group, Parent Group. i. In the Tablix group window, under Group by, set up grouping by the following expression: [CLE_Entry_No_], select Add group header and click OK. FIGURE 2.31: INSERT GROUP WINDOW 2 - 38 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement right-click on it. (LCY) Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . CLE_Posting Date iv. You need to insert caption values for the following fields from the Customer Ledger Entry table: i. FIGURE 2. (LCY) x. Populate the group header row with the customer ledger entry data captions. Remaining Amt. Assign the text box expressions for the Customer table as described above. Customer No. vi.39 . Currency Code viii. CLE_Amount ix. Original Amt.Module 2: Interactive Features j. Inside Group – Above. k. CLE_Document Type v.32: INSERT ROW WINDOW l. CLE_Entry No. Description vii. Populate the inserted row with the caption values of the fields from the Customer Ledger Entry table. ii. CLE_Document No. and then click Insert Row. Select the first row where the cell expression is [CLE_Entry_No_]. iii. Below.  Entry Type  DCLE_Posting Date  DCLE_Document Type  DCLE_Document No.  Journal Batch Name Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . and set Hide in the Change display options area.40 n. As a result. Select the first group header row and set the BackgroundColor property in the Properties window for it to an arbitrary color. you should have a table with 3 group rows.  Transaction No. This will create the necessary indent under the Customer table. Select the Visibility tab. q. p.Reporting in Microsoft Dynamics® NAV 2013 m. When needed. FIGURE 2. s. but make it a different color. r. Click OK to close the Text Box Properties window. right-click the shaded border to the left of it and then click Insert Row. shrink the columns to make the table fit inside the list. v. Place the appropriate detailed ledger entry field captions into the third row. and 1 table footer row. t. Populate the second group row with values of the fields of the Customer Ledger Entry table. and 1 group data row. Repeat the same action for the second group header row. Ledg. u. o. Skip the column between Description and Currency Code fields. Entry table:  DCLE_Entry No. For the left-most grouping cell in the table.33: ADD FIELDS WINDOW 2 . Select the second table row. You need to insert caption values for the following fields from the Detailed Cust. right-click and select Text Box Properties. Insert another row below in the group to store detailed ledger entry captions. A similar procedure must be performed for the Transaction No. g. Do the same for the cell containing the value of the Customer No. Merge the cell containing the caption of the Customer No. FIGURE 2. f. and Entry Type fields are located directly under the Customer No. field (next row below). and then clicking Merge Cells. Leave blank cells where empty space must be located (under the Currency Code field of the Customer Ledger Entry table and to the left of that column). Ensure that the values of all caption fields begin with =Parameters (displayed as @) and the values of fields do not contain any additional operators. Shrink the column containing the Customer No. c. and Journal Batch Name fields. field of the customer ledger entry to about half of its size. and Entry type fields of the Detailed Customer Ledger Entry table to the text boxes in the first data row. Right-click the column header and then click Insert Column. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . Insert the rest of the fields from the table (see the list above).  Amount (LCY)  Debit Amount (LCY)  Credit Amount (LCY) To ensure that the Entry No. which must be located under the Description field of the Customer Ledger Entry table. Assign expressions representing the captions of the Entry No. b.34: MERGED CELLS WINDOW h. Right. with values of the appropriate detailed customer ledger entry fields by placing them below the corresponding captions (see the list above). Select the group row and set the BackgroundColor property for it to an arbitrary color. right-clicking them.41 .Module 2: Interactive Features 9. Fill the last table row. follow these steps: a. i. e. d. which is the Data row. field with the cell in the inserted column by selecting the two cells. field of the customer ledger entry. Repeat the same for the value of the Description fields (caption and value rows). FIGURE 2. Select any row which is grouped by [CLE_Entry_No_].35: DETAILS BACKGROUNDCOLOR WINDOW 10. FIGURE 2. and click Row Group. b.36: GROUP PROPERTIES WINDOW 2 . To hide the empty cells with no data. In the Group Properties window. Group Properties. a. Set the BackgroundColor property for the details row to an arbitrary color.Reporting in Microsoft Dynamics® NAV 2013 j.42 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . we need to place the relevant filters. right-click on the shaded border to the left of it. select the Filters tab and click Add to add a filter as shown in the screenshot and click OK to apply the filter. a. Ledger Entry table. and set Hide in the Change display options area. d. assign the following expression to the text box: =Sum(Fields!CLE_Amount. In the Expression window. b. d. e. Parent Group. clear it. In the Toolbox pane. Click OK to close the Text Box Properties window. Place the field that displays the total amount with its respective caption into the footer row of the table storing the ledger entry data. b. click the Table control and drag it to the list below the Cust. under the Amount field from the Cust. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . b. Right-click the left-most cell in the last table row and select Text Box Properties.Module 2: Interactive Features 11. Shrink the table to about half the list width. Insert another table to store the sales document data. enter the formatting expression for this text box as follows: =Fields!CLE_AmountFormat. Click OK. in the Properties window. in the Properties window. click the AssistButton next to the Hidden property and select Expression. Insert columns into the table to have a total of five columns. For the last row of the table. In case the cell in the top row of the current column is populated with Total Caption. Ledger Entry table.Value. Select the Visibility tab. 12. Hide the total amount for the cases where no customer ledger entry is available. enter the hidden expression for this row as follows: =Fields!CLE_Entry_No_. c. Delete the first header row from the table. Select these two cells and set the BackgroundColor property for them to a different arbitrary color. d. e.Value). Select the data row and right-click on the left shaded border to the left. Locate the data set item which represents the caption for the total field (Total_Caption) and assign its expression to the merged cell. g. a. Click Add Group. For the filled in cell. f. For the last table row. Merge the two cells located to the left of the inserted field. c. 13. click the AssistButton next to the Format property and select Expression. e.Value = 0. Click OK. c. In the Expression window. a.43 . i.  SH_Posting Date  Prices Including VAT  SH_Amount n.Value l.37: TABLIX GROUP WINDOW h. which is the grouping one. For the first table row. Fill in the table data row with the data set items for the field values of the Sales Header table which correspond to the captions inserted into the header.44  SH_Document Type  SH_No.Reporting in Microsoft Dynamics® NAV 2013 f. Set its Hidden property to True. Reduce the size of the first column. The values of all caption fields should begin with =Parameters. k. Click OK to add the group. Select the two table header rows and set the BackgroundColor property for them to an arbitrary color. doubleclick Sales_Documents_Caption from the Parameters category and click OK. o. j. locate the data set item which represents the caption of the sales documents section (Sales_Documents_Caption). m. p. in the Parameters category. Click the Expression button next to the Group by field. Select the Add group header check box. g. Fill in the second table group header row with the appropriate captions of the Sales Header table. FIGURE 2. and then click Insert Row. Inside Group – Above. Right-click the first row in the table. Make sure that expression is as follows: =Parameters!Sales_Documents_Caption. merge all cells (except the first large grouping cell) and. Captions for the following fields from the Sales Header table are required: 2 . Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Ensure that no filters are specified on the request page and click Preview. and asking to load the changes. When you use an external image in a report. t. r. Select any row from this table. You can also use an image as a background for certain report items. v. Using Images in a Report Using Images in a Report An image is a report item that contains a reference to an image that is stored externally. Resize the list control so that it exactly matches the height of the three tables inside it. ee. Click Yes to save the modified files. and then click OK. y. bb. Resize the report body section so that it exactly is the size of the list control. dd.45 . right-click the shaded border to the left of it and then click Tablix Properties. In the menu bar.Module 2: Interactive Features q. Click the Print Layout button in the Print Preview window. Save and compile the report in the Object Designer. Click the Close button to exit Microsoft Visual Studio. the image data is stored within the report definition and does not exist as a separate file. s. z. click Build. An image can be a logo or picture. Inspect the Output pane and ensure that there are no errors. embedded within the report. aa. and in the Report Dataset Designer. When you use an embedded image. Build Web Site. Select the table data row and set the BackgroundColor property to a different arbitrary color. select either a blank line or another data item (a data item that differs from the current selected data item). however. Click Yes on the warning message stating that the report layout has been changed by another application. the image item contains a path that points to an image on the server or network. cc. w. Go back to the Dynamics NAV 7 Development Environment. u. x. Run the report from the Object Designer. Go to the Filters tab and set a filter as shown in the screenshot. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . Observe the report output (the 1st and 2nd pages of the report are displayed in the screenshot below). or it can be a picture that is repeated with rows of data. or stored in a database. Embedded images ensure that the images are always available to the report. the pictures that appear alongside product names in a product list are database images. select an image file. you can work with three sources of pictures: • Embedded images • External images • Database images (Stored in BLOB fields and streamed with the dataset. the image source is set to External and the value for the image is the URL address to the image. for example. You can include stored images in a report by specifying a Uniform Resource Locator (URL) to the image.) Embedded Images Embedded images are images that are stored in the report.Reporting in Microsoft Dynamics® NAV 2013 External images work well for logos and static pictures that are shared among several reports. Images can be displayed using the Image control. Data-bound images can also be displayed from binary data stored in a database. Report definitions with external images are smaller than definitions with embedded images. You can embed images in a report so that all image data is stored within the report definition. New Image. select Report Data. To use external pictures. but it also increases the size of the report definition. Using an embedded image ensures that the image is always available to the report.46 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . To import images in the report. 2 . but they cannot be shared. and click OK. External Images External images are not stored in the report or in a database. Using external pictures is not recommended for security reasons. In the Visual Studio Report Designer. the Internet. When you use an external image in a report. For example. Report Designer encodes the image and then stores it as text in the report definition. the EnableExternalImages property must be set to True. External pictures are supported in Microsoft Dynamics NAV 2013. When you embed an image. Click the New Image button. Instead they come from a public external location. If you want to print a "standalone" picture (such as a company logo). Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . image/gif. After you insert the Image control. If the Source property is set to External or Embedded. there are three important properties: • Source: This property indicates the source of the picture. which implies that the image must be added as a Column in the Report Dataset Designer. You can also use an expression to define the picture source. The property is used in HTML to render the picture in the correct way. for example. Image Properties When working with pictures. image/jpeg and so on. Embedded and Database. you can also work with pictures that are derived from the Microsoft Dynamics NAV database. Database pictures can be added to Header. the value of MIMEType is ignored. Body and Footer sections. and insert an image control in a table cell. to print an item catalog that includes the item pictures. MIMEType applies only if the Source property is set to Database. you must first add a control to the report that can contain an image: the image control. MIME is an Internet standard for describing the contents of a file. The property can contain an image name (for embedded images) or a field from the dataset (for database images). • Value: This property contains the name of the picture that is displayed in the image control. Adding Images To add an image to a report.47 .Module 2: Interactive Features Database Pictures from Microsoft Dynamics NAV In the report. or to print the company logo that is stored in the Company Information table. Supported options in Microsoft Dynamics NAV 2013 are External. • MIME Type: This property contains the MIME Type of the picture. A prerequisite of adding a database image course is that the image is part of the dataset. Examples are image/bmp. you can use the other properties to further fine-tune the layout and the position of the image control. you can work with a single Image control. If you want to print a picture as part of a record. you will have to work with a repeating container (such as a table control). Reporting in Microsoft Dynamics® NAV 2013 Background Images You can use an image as a background image in the body. but not the page header or footer. 2 . In Select the image source. In the General page of the Image Properties dialog box. follow these steps. header and/or footer of the report or in a rectangle. For this option. (Optional) In the Tooltip text box. you must type a URL to the image or select a dataset field that contains a URL to the image. In Visual Studio Report Designer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . list. you must explicitly define a different image for those regions. type a name in the Name text box or accept the default. External Choose this option when you specify an image that exists on the report server or on a web server. click the option that specifies where the source for the image exists. b. If you do not want to use the background image in the header or footer. c. If you define a background image for the report body. or table. Select View. Demonstration: Adding an Image Control Mort is asked to modify the layout of an existing report. click the design surface to create an image item of fixed size. matrix. ii. HTML reports will automatically use the same background image in all three regions of the report. type text to display when the user hovers the mouse over the image in a report generated for HTML. you can create and assign a small transparent image to the header or footer to create the effect of having no image at all. a. and add an image. In the Object Designer. g. d. If you do not want any image to appear in those regions. i. Alternatively. f. Embedded Choose this option when you specify an image that is part of the report definition. Demonstration Steps 1. e. You can also specify how the image is repeated to fill the background of the item. click Image in the Toolbox. Layout to open Visual Studio Report Designer.48 To add an image control to the report. select report 123456700 and click Design. Click a location on the design surface and drag the mouse to create a box that is the size of the desired image. A background image has the same properties as an image. text box. click the design surface and then drag the mouse to create a box that is the size of the desired image. c. view the next procedure. The file is displayed under the Images folder in the Report Data pane. e. click Open and then click OK. select the file Image. To change the MIME type. and then click Add Image. The Image Properties dialog box opens. Alternatively. d. d.49 . b. In the Image Properties dialog box. c. Visibility. in the Report Data pane. click the design surface to create an image item of fixed size. select the image file type. (Optional) Click Size. click Image in the Toolbox. navigate to the file. To a Database Image to a Report: a. and then click Open. or accept the default. In Visual Studio Report Designer. Demonstration: Adding a Database Image to a Report Demonstration Steps 1. type text that will display when the user hovers the mouse over the image in the rendered report. click Import.Module 2: Interactive Features iii. In Visual Studio Report Designer. In Files of type. b. Click OK. On the design surface. drag the image from the Report Data pane to the design surface. h. Database Choose this option when you specify a dataset field that is bound to a database field that contains an image. or Border to set additional properties for the image report item. The MIME type is derived when the image is imported. To add the image to the report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . i. rightclick the Images node. Demonstration: Display an Embedded Picture in a Report Demonstration Steps 1. Action. Click OK. type a name in the Name text box. To add an embedded image in a report: a. Alternatively. (Optional) In the Tooltip text box.png. the expression must evaluate to a valid path to an image. or Database. f. report body. type or select an expression that evaluates to the source of the image. This can be a static path to an image hosted on a report server. and some parts of a chart. Demonstration Steps 2 . BackgroundRepeat can be set to Fit. select the MIME type of the image. f. In Select the image source. Embedded. RepeatX. for example. or RepeatY. For background images in a chart. If the Source property is set to Database. NoRepeat. select Database. the expression must evaluate to a field that contains binary image data. text box. but not RepeatX or RepeatY. select the appropriate MIME type for the image. In Visual Studio Report Designer. select Repeat. c. or it can be a path based on a field. and then do the following: a. page footer. select External. g. If the Source property is set to External. h. If the Source property is set to External or Embedded. from the View menu. the expression must evaluate to the name of an image that is embedded in the report. expand BackgroundImage. b. h. Click OK. select the field that contains the image. If the Properties pane is not visible. tablix. For BackgroundRepeat.50 1. MIMEType applies only if the Source property is set to Database. the value of MIMEType is ignored. For Value. page header. a chart area. In the Properties pane. For MIMEType. select the report item to which you want to add a background image.Reporting in Microsoft Dynamics® NAV 2013 e. In Use this Field. If the Source property is set to Embedded. 2. click Properties Window. In Use this MIME type. You can define a background image for any selected item on the report design surface that displays BackgroundImage in the Properties pane. d. For Source. e. chart. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . g. Demonstration: Adding a Background Image for a Report Background images apply to a rectangle. • Print (or export) the report.38: THE REPORT VIEWER TOOLBAR WINDOW You can use the Print button to send the report to the printer. Cancel will close the pop-up menu and you will return to the client. Print will send the report to the printer. You can use the Report Viewer to preview the report before you send it to the printer. In addition to these options in the request page. FIGURE 2. Note: Note that the print button is not available if the C/AL code in the report contains the function: currReport. In this page. a request page appears (If you have set this to appear). you can also apply filters to the report. or save it as a PDF or Microsoft Excel™ or Microsoft Word™ file. At the top of the Report Viewer window there is a toolbar with several buttons. • Preview the report. How Does It Work? When you run a report.PREVIEW() Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 .Module 2: Interactive Features Print Preview and Print Layout This section explains the difference between the two modes: Print Preview and Print Layout. you can have three options: • Cancel the report.51 . but Preview will open the Report Viewer. or fill in options in the Options Tab. if options are defined for the report. By clicking the Print Layout button again. Visibility Options With the report viewer. and at the same time. the report will be regenerated in the Print Layout mode. 2 . However. the data region will get a small plus (+) icon. you can switch back to the Print Preview mode. particularly in Germany. the region will collapse and the icon will revert to a plus (+) icon. You also want to view the details for Germany. the user can dynamically expand and collapse groups of data. and gradually move into the content of a report. Additional Reading: For more information about report rendering behavior. If you click the Print Layout button.Reporting in Microsoft Dynamics® NAV 2013 To the right of the Print button is the Print Layout button. The Visibility Feature The Visibility feature is a toggle feature you can use to dynamically show or hide data regions using the Expand/Collapse technique.1. you will not have a visual depiction of the width of the page and the page breaks. the region will expand. Review report 123456700.com/fwlink/?LinkId=267270 Working with Visibility Options This lesson describes the interactive features (such as visibility options. Suppose you want to view the sales amount realized by John Roberts. This mode will provide you with a visual depiction of how the report will print on paper. you want to view the correct totals for all countries and regions. Lesson Objectives Describe the visibility options in reports and how to use them. The next paragraph will show you how to work with visibility options. including those you are not interested in at this time. If you click it again. If you click it. please read: http://go. All the details are visible.microsoft.52 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Sales by Salesperson . country/region code. customer number and document type. Once the information is printed. and at the same time. The report contains an overview of the total sales and profit amount separated by salesperson. which will make the report complete and easier to analyze. interactive sorting and document maps) that can be added to reports. the icon will change from a plus (+) icon to a minus (-) icon. you cannot collapse specific sections.L1. When you add the visibility feature to a specific data region. if you select the Print Preview mode. ) To add the totals to the group header. (You can also copy or move the fields from the footer row. (In this case. to influence the visibility of grouped data (table rows. matrix columns). so that the subtotals are visible without having to expand the individual groups. Visibility and Totaling Although you have added visibility options for the different groupings. users can hide and display items interactively. Although it can be defined for each cell. For a table or matrix.Module 2: Interactive Features Conversely. visibility options defined for a group header will also apply to the corresponding group footer. you still need to expand the different groups and examine the group footers to know the subtotals for each group. The main reason for hiding items is to provide a report that shows summary data. or rows and columns that are associated with groups. Often you will define visibility options for all levels except the highest data level. You can now disable the individual footers. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . By providing a toggle on a text box. the user can click the text box to expand and collapse the detail data. you can initially hide all the rows except the outer group summary row for a table with row groups. you can show or hide static rows and columns.53 . the group footers become obsolete. as described in the Delete a Group Header or Group Footer section. select the fields in the dataset and drag them to the correct cell in the group header. Implement the Toggle Visibility Functionality The visibility feature is typically used in data region controls. you normally define it by table row. For each inner group (including the details group). the header will contain the same information as the footer. you can have the totals display in the group header row. so that a user can drill down into detail data. When the report is rendered.) When you add a numerical field to a header or footer. add a toggle to the grouping cell of the containing group. Visibility options are often defined in a cascading scenario. For example. To avoid this. the Sum() function will be added automatically. As a result. a. In the Report Item field. On the Visibility Tab. Click Design to open the Report Dataset Designer. Import Report R123456721. e. h. Select View. Select Hide. select the control that can influence the visibility of the selected table row. Select the Display can be toggled by this report item check mark. The following steps show how to define visibility options for a table row. you can repeat this procedure to define it for the remaining levels. b. c.39: REPORT WITH VISIBILITY OPTIONS WINDOW 2 . and Document Type group headers and the table details row (showing the individual customer ledger entries). Now that you have defined the visibility for one level.value. select an initial visibility state for the data level. Layout to open Visual Studio Report Designer.Reporting in Microsoft Dynamics® NAV 2013 Demonstration: Adding Toggle Visibility Options In report 123456700. f. g. Select Group Properties. the result will be similar to the Report With Visibility Options figure. d. Customer No. If you run the report afterward. Click OK to close the Grouping Properties window.54 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .fob and confirm. If you select Hide. Select Customer__Salesperson_Code_. Click the row group in the Row Groups window for the group you want to add visibility options to. the data region will be collapsed. Demonstration Steps 1. The default state is Show (which means that the data region will be expanded). select the Country/Region Code group (group2). In this case. FIGURE 2. you would define visibility options for the Country/Region Code. i. These can be single or multiple field keys defined and enabled at table structure level. in preview mode. you must run the report again. might have a negative impact on performance. and other objects to sort data in the order that you want. And you can also use these programmatically. pages. Subsequent clicks toggle the sort order between ascending and descending order. you can have the user define the sorting order. or you can predefine the sorting order (using the DataItemTableView property on data item level). columns that support interactive sorting have arrow icons that change to indicate the sort order. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . Note: Note that implementing interactive sorting on a report that has a big dataset. the details of the next level are shown. The report viewer client also supports interactive sorting. reports. you will be able to support multiple user requirements while minimizing development time. the details are hidden again. Interactive Sorting Sorting data in the Microsoft Dynamics NAV pages is strictly related to keys. the sorting order is defined before the report is printed. if you click the button again. If a different sorting order is required.Module 2: Interactive Features Notice that the report shows only the two salespersons. The first time you click an interactive sort button. according to one of these keys. When you work with interactive sorting. This is often used to influence the visibility of individual controls. In reports. If you click the Expand/Collapse icon. The details for the Country/Region Code grouping (and all underlying groupings) are hidden.55 . You can have the initial visibility state determined by an expression. When you view the report. Using expressions will be described in the Adding Code to a Report module. you can use it in tables. The different sorting orders for data must be defined as keys. items are sorted in ascending order. After you define a key. This means that you can add sort buttons to the data columns and use them to change the sorting of the data after the report is run. In either way. • Which text box to add the sort button to: In the column header or in the group row header? • Whether to synchronize the sort for multiple data regions: You can design a report so that when the user toggles the sort order. you will affect the sorting of the data in the current group (and underlying groups). taking into account the Initial visibility settings. detail rows. For example. you can sort on rows associated with row groups. Visibility options might have a side-effect on interactive sorting: when you change the sorting on a column. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . interactive sorting will depend on grouping. but it should not affect the sorting and will not affect the grouping that is defined on a higher level. In this case. the data will be sorted according to the selected column and the selected sort order (ascending or descending). and the third in ascending order again.56 • What to sort: Rows or columns? • What to sort by: A field that is displayed in a table column? A field that is not displayed? • What context to sort in: For example. the data for the current group will be refreshed. from top to bottom and from left to right. The user can then choose which column to sort by.Reporting in Microsoft Dynamics® NAV 2013 What is Interactive Sorting Interactive sorting can be defined on multiple columns. you must remember to first select the right sorting order for the different columns before you expand the data groups. The most common use of an interactive sort is to add a sort button to all column headers. columns associated with column groups. you must specify the following items: 2 . When you combine interactive sorting and visibility options. you can have the first column sorted in ascending order. In reports with grouping. child groups within a parent group. the second in descending order. The interactive sort functionality is limited to a specific group of data. interactive sorting will affect the whole data region. By changing the sorting of a specific group. When you add an interactive sort. In reports without grouping. or parent and child group together. For reports with grouping. it is important to define the correct sorting scope. For each column the user can select the sort order. and equals interactive grouping: data will be sorted and also grouped differently (because each record will be a group on its own). other data regions with the same ancestor also sort. Demonstration Steps 1. second column) and select Text Box Properties to open the Text Box Properties window. Click OK to close the Text Box Properties window. save and import the RDLC changes. Exit Visual Studio. for example [Customer__Salesperson_Code_].No Grouping Mort needs to add interactive sorting to report 101. e. enter a check mark in Enable an interactive sort action on this text box. so that customers can be sorted interactively on the salesperson code. FIGURE 2. save and compile the report in the Report Designer and run the report. In the Sort by field. c. b. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . The following steps show how to activate interactive sorting for a column in a report without grouping. Customer . Right-click the cell (first row. On the Interactive Sorting Tab.List.57 . select the name of the field to sort on. a.40: ADDING AN INTERACTIVE SORT TO A TEXT BOX WINDOW d.Module 2: Interactive Features Demonstration: Adding Interactive Sorting . Open report 123456700 in Visual Studio Report Designer. On the Interactive Sorting Tab. 2 . choose to open the Import Worksheet window.58 The following steps show how to activate interactive sorting for a group header field in a report with grouping. Browse to the report R123456713.Reporting in Microsoft Dynamics® NAV 2013 Demonstration: Adding Interactive Sorting . and by Item Description. Right-click the cell and select Text Box Properties to open the Text Box Properties window. c. enter a check mark in Enable interactive sorting on this text box. so that he can sort by Customer No. column does not contain a caption. In this case. Demonstration Steps 1. a. g. In the dialog box. k. e. field. Michael wants to sort the data by Item No. In the Action column. Import. Mort receives similar requests for other reports. select the name of the field to sort on. Select the header cell for the column you want to add an interactive sort to.Grouping (Group Header Field) After he introduced interactive sorting in some reports. Object Designer to open the Object Designer. You can either include one or leave it blank. Select File. Customer/Item Sales 2. an interactive sort must be added to the Customer No. which is a group header field.fob. Click Open to import the object in the database h. Open report 123456713 in Visual Studio Report Designer. Additionally. column. f. In the Sort by field. b. Select Tools. verify that the action is set to Create. Michael asks him to change the sorting in report 123456713. d. l. Mort will first define interactive sorting on the Customer No. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . j. Click Open to start the import. i. Note that the Customer No. and then select [Customer__No__]. save and compile the report in Report Designer and run the report. save and import the RDLC changes. Click OK to close the Text Box Properties window. In Choose what to Sort: select the Group option. n. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 .Module 2: Interactive Features m. This means that changing the sort order will only affect the selected group (and the underlying groups).59 . select Table1_Group.41: INTERACTIVE SORT FOR A GROUP HEADER FIELD WINDOW o. Exit Visual Studio. In the Choose data region or grouping field. FIGURE 2. It is important that you select the correct scope for each group). On the Interactive Sorting Tab. Select the header cell for the column you want to add an interactive sort to. 2 . This means that changing the sort order will only affect the detail scope of the table.Reporting in Microsoft Dynamics® NAV 2013 Demonstration: Adding Interactive Sorting . b. In the Sort by field. In this case. Demonstration Steps 1. and Item Description fields. field (in the first column). c. Mort needs to add interactive sorting for the Item No. d. Right-click the cell and select Text Box Properties to open the Text Box Properties window. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . select the Detail Rows. select the name of the field to sort on.Grouping (Detail Field) Now that an interactive sort is added to the Customer No. enter a check mark in Enable interactive sorting on this text box.60 The following step shows how to activate interactive sorting for a detail column in a report with grouping: a. e. In this case. you will add an interactive sort to the Item No. select [ValueEntryBuffer__Item_No__] f. In the Choose what to sort. Open the report in Visual Studio Report Designer. field. h. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . In the Choose data region or grouping field.61 . Exit Visual Studio. Click OK to close the Text Box Properties window. l.Module 2: Interactive Features FIGURE 2. n. save and import the RDLC changes. In the Sort by field. Click OK to close the Text Box Properties window. enter a check mark in Enable an interactive sort action on this text box. you will add an interactive sort to the Item Description field (in the first row. Right-click the cell and select Text Box Properties to open the Text Box Properties window. Next. third column). On the Interactive Sort Tab. m. j. again select the Detail Rows option. select [Item_Description]. In this case. k.42: INTERACTIVE SORT FOR A DETAIL ROW FIELD WINDOW g. select the name of the field to sort on. save and compile the report in the Report Designer and run the report. i. Reporting in Microsoft Dynamics® NAV 2013 Working with Document Maps In this lesson.62 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . a document map appears on the side of the report. It appears as a separate side pane next to the report content. In this case. the report content at the right side will be refreshed. When you click an item in the document map. You can use a document map in a report so that users can navigate to certain areas of the report. If you change the sorting of the report. When you view an Excel or PDF report. the document map will be rebuilt to follow the sorting of the document. All items in the document map are listed one after the other down the pane. The document map will be rendered differently depending on how the report will be exported: • PDF renders a document map as the Bookmarks pane. you can add a document map for each data region control. Lesson Objectives Explain how document maps work and how to add them to a report. If the report contains multiple data region controls. and how to define a name and map levels for the document map. What is a Document Map A document map is a report feature that is used to quickly navigate through the contents of a report. you will learn what happens to the document map when you export it in different formats. Additionally. You can add multiple document maps to a report. Clicking items in the document map refreshes the report and displays the area of the report that corresponds to the item in the document map. 2 . • Microsoft Word does not render the document map. it is recommended to specify a document map label for each data region control. The document map has a tree view structure. and functions as a table of contents. Document maps provide a hierarchical overview of the information in the report. and they can contain entries for the different groups that are defined. Report sections are rendered in separate worksheets that are included with the document map in the same workbook. There is no hierarchy to the list of links. • Microsoft Excel renders a document map as a named worksheet that includes a hierarchy of links. you will learn how to improve the navigation of a report by working with a document map. g. In this example. The following steps show how to create a document map. and include the Customer Name in the document map. c. Group4) and the corresponding fields([Customer__Country_Region_Code_]. in the Document map field. You can use the name to identify the data region control in the document map. enter a name for the data region in the DocumentMapLabel field. and then save and compile the report in the Report Designer. for example Group1. select the field that you want to show in the document map. Click OK to close the Grouping Properties window. e. Open report 123456700 in Visual Studio Report Designer. select [Customer__Salesperson_Code_]. In the Advanced Tab. b. you can group the data on Customer No. and click Group Properties. save and import the RDLC changes. a. For example. On the tablix properties.63 . f. select the group that you want to include in the document map. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . [Customer__No__]. You can even combine multiple fields by entering an expression. (You can select other fields than the one in the Group on field. Repeat steps 2 through 4 for each group level that you want to include in the document map (Group2.Module 2: Interactive Features Demonstration: Adding a Document Map Demonstration Steps 1. This is convenient if the report contains multiple data region controls. Group3.) d. On the Row Groups Tab. Exit Visual Studio. [Cust__Ledger_Entry__Document_Type_]). the result is similar to the A Report With A Document Map figure. all document map entries will be included sequentially.43: A REPORT WITH A DOCUMENT MAP WINDOW Notice the Expand button in the top left corner. If you do not specify any names for the different tables. If this is how you define the document map settings. However it is recommended to do this when the report contains multiple data region controls. 2 . Specifying a document map label for the table is not mandatory. Note: If you want to hide the Document Map you could do this in two ways. FIGURE 2.64 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Click in the small left arrow placed in the middle of the separating column between document map and report or right click anywhere in the report and uncheck the Document Map option.Reporting in Microsoft Dynamics® NAV 2013 When you run the report. you must open the Table Properties window instead to specify a document map label for the table. and the document map will lose some of its added value. The Document Map Settings The document map settings are defined in the Grouping Properties window. In the Group by field. For best results. Properties that you set at the page level are applied to each column in the report. giving the appearance of multiple columns. 2. consider to create a codeunit that delivers the report as a . select the field that you want to add to the map in the DocumentMapLabel field. A newsletter-style layout applies to the entire report. Creating a Multi Column Report What is a Newsletter Style Report You can design multi-column newsletter-style reports whereby data flows down multiple adjacent columns. a newsletter-style layout is displayed as a single column. the report server creates each column as a series of very narrow pages that are rendered in close sequence.65 . Click OK to close the Group Properties window. use the Table or List data region. When you specify a newsletter-style layout.pdf file to a shared folder location. select the field that you want to group the data on. 3. On the Advances Tab. To view a newsletter-style report. and then open the file from the file system. Viewing a Multi Column Report Not all rendering extensions support a newsletter-style layout. In Preview and in the rendering extensions that produce Excel and Word output. 1. This is typically the default sorting field. 4. In the Row Groups window. select the detail group and select Group Properties. You can define as many columns you want. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . You can use the following rendering extension to view a newsletter-style report: • PDF You can preview a newsletter-style report using Print Preview. It is not possible to specify a newsletter-style layout on the top half of the report. For best results.Module 2: Interactive Features You can also include a document map in reports that do not define groups. you must export it to a PDF file. and a tabular layout on the bottom half of the report. Demonstration Steps 1. b. g. Browse to the report R123456716. choose to open the Import Worksheet window. Select Tools. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Import. Report Viewer calculates the width of the columns in the report. A newsletter-style layout applies to the entire report. Additional columns are displayed so that you can verify that the number of columns you defined will fit the page size dimension. f. When you define more than one column in a report. In the dialog box.Reporting in Microsoft Dynamics® NAV 2013 Demonstration: Create a Newsletter-Style Report Multicolumn. i. Click Open to start the import. The report properties appear in the Properties pane. c. verify that the action is set to Create. newsletter-style reports display report data down multiple adjacent columns.fob. 2 . padding. e.66 To create a newsletter-style report a. Click Open to import the object in the database. In the Action column. h. Select File. Object Designer to open the Object Designer. select Report from the dropdown list in the Properties pane. It then displays a reduced design surface so that you can place report items on the report that will fit within the column. and margins to fit more columns on the page. In Visual Studio Report Designer. You can adjust page size. the width of the report. d. Note that the layout of the entire report must be placed on the reduced design surface. and the width of the space between columns based on the number of columns. Open report 123456716 in Visual Studio Report Designer. k. For example. mm. you can apply the formatting styles that you want. or pc after the numeric value. To designate a different unit. In the Properties pane. pt. if you want to format the contents of an entire text box or a selected word within the text box. right-click the item and select Text Box Properties. You can format the text boxes and individual items within text boxes. FIGURE 2. In Columns.5in.Module 2: Interactive Features j. expand the Columns node. You can change formatting options by selecting the item that you want to format and then opening the item's Properties dialog box.44: MULTI COLUMN REPORT WINDOW Note: The default unit of measurement is based on the user's locale settings. Then. type 2 as the number of columns in the report. and the data while in design mode. Formatting Reports and Report Items Formatting the items in your report makes the report look more attractive and enhances its readability. l. In ColumnSpacing. the images. the expressions. type a physical unit designator such as cm. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . type the width of the space between columns as 0.67 . You can add a placeholder to a text box by creating an expression using one of the following methods: 2 . and effects all contribute to the readability of a report. add bold and italic styles. The value of this placeholder will be the field expression that corresponds to the field that was dropped. if you type Name: [Name] into the text box.68 • Drag a field from the Report Data pane and drop it into the text box. fonts. The value of a placeholder is always a simple or complex expression. Font. By default. You can format an entire text box or you can format specific text. Font. • Right-click anywhere in the text box and select Create Placeholder. and use paragraph styles such as alignment and hanging indents. actions. and other behavior on any number of placeholders or sections of text within a single text box. color. the resulting expression is converted into a placeholder that you can edit. 10 points. You can define colors. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . By using the Text Box Properties dialog box. the report font that is used is Arial. the resulting UI representation of this expression is known as a placeholder. In the Placeholder Properties dialog box. the equal sign is treated as a string literal and a placeholder is not created. a calculated field. For example. a pointer to a field in a database. size. and underline effects can be applied to text within a text box or data region. If you drag the expression anywhere else on the report body. or fields within the text box. When a simple or complex expression is defined inside a text box. You can mix fonts and colors.Value • Type an expression in an empty text box by starting with an equal sign (=). font size. expressions. numbers. a new text box will be created that contains the placeholder. or the equal sign is inserted anywhere but as the first character in the text box. • Type any simple or complex expression into the text box. font style.Reporting in Microsoft Dynamics® NAV 2013 To Format a Textbox With a Placeholder A text box can be a report item or an individual cell within a data region that contains text. and black. you can specify an expression as the value of your placeholder. or a combination of all three items. the [Name] text will be displayed as a placeholder that represents the expression =Fields!Name. If the text box is not empty. When you change the focus off the text box. you can specify how the text appears when the report is rendered. You can change the underlying expression by double-clicking the placeholder or right-clicking the placeholder and selecting Placeholder Properties. not sections of the placeholder. Using HTML in a Text Box The text box report item enables you to insert HTML-formatted text that you have retrieved from a field in your dataset into a report. <DIV>. The following is a list of tags that will render as HTML when defined as placeholder text: • Hyperlinks: <A href> • Fonts: <FONT> • Header. You can format only the entire placeholder. You can also specify a UI label using the Label property in General of the Placeholder Properties dialog box. <SPAN>. This can be useful if you want to add a hyperlink for a string of text that is contained inside a text box.69 . <LI>. actions. <DIV>. Formatted text can be rendered to all supported output formats. If you want to see the underlying expression.<P>. you can separate the paragraphs by pressing ENTER in the text box. You can also set an alignment value for any individual string of text. <U>. use multiple paragraphs within a single text box. You can define colors. you can pause your pointer on the placeholder. Unlike placeholder text. For example. fonts. <I>. This will be the text that is shown at design-time for the placeholder. You can also use multiple paragraphs inside a single text box. You can also define an action for individual text in a text box. The text can come from any simple or complex expression that evaluates to correctly formatted HTML. and other behavior on any subset of text within a single text box to create a mail merge or template for text in your report. <HN> • Text format: <B>. style and block elements: <H{n}>. you can align individual text in a text box separately. <UL>. including PDF. if you have two separate paragraphs of text. Note: Actions defined on the text box have a higher priority than actions defined for individual text in a text box. <S> • List handling: <OL>. and define other behavior for any subset of text.Module 2: Interactive Features Formatting Placeholders and Static Text in a Text Box You can format placeholders using the Placeholder Properties dialog box. <LI> Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . if the text box has multiple blocks of text. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . f. Repeat steps c through f for the remaining text you want to format. Any expression can be defined and formatted separately using a placeholder. the HTML tags are ignored and the structure of the text is defined by the blocks of text. select the Font tab and in the Style select Bold. and Reporting Services detects a conflict between the HTML and existing report constraints. Inside the text box. d. Note: When you use text that contains HTML markup. e. type some text and select the text you want to format. g. only the innermost HTML tag will be treated as HTML.70 To combine multiple formats in a text box a. In the Toolbox. c. Because only a subset of HTML tags is supported.Reporting in Microsoft Dynamics® NAV 2013 Any other HTML markup tags will be ignored during report processing. Demonstration Steps 1. If more than one tag is defined for text. the data must always be parsed by the text box first. Demonstration: Combine Multiple Formats in a Text Box You can format any part of the text separately within a text box. the placeholder is rendered as plain text. 2 . For example. Click OK. and click Text Properties. However. or drag it to the design surface. the HTML that is shown in the rendered report may differ from your original HTML. If the text in your text box contains only one block of text. double-click a Textbox report item. b. Set formatting options. Open report 123456714 in Visual Studio Report Designer. If the HTML represented by the expression in the placeholder text is not well formed. This ability to mix formats by adding placeholder text enables you to create mail merges or templates for text in your report. Right-click the selected text. any HTML in the placeholder that defines block elements will render correctly. All HTML tags are case-insensitive. 71 .45: TEXT PROPERTIES WINDOW Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 .Module 2: Interactive Features These steps are visualized in the following diagram: FIGURE 2. 2 . Demonstration Steps 1. This causes the field to be evaluated as HTML. and Images Visual Studio Report Designer Services gives you the ability to format lines. Click OK.Interpret HTML tags as styles. c.46: PLACEHOLDER PROPERTIES WINDOW Formatting Lines. you can import HTML from a field in your dataset for use in the report. in the second textbox of the second row. Click HTML . For example. e. When you drag a field from your dataset into a text box.72 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . To add HTML from a field in your dataset into a text box a.Reporting in Microsoft Dynamics® NAV 2013 Demonstration: Add HTML From a Field in your Dataset into a Text Box Using a placeholder. Open report 123456714 in Visual Studio Report Designer. so you will need to change the placeholder mark-up type to HTML. By default. a placeholder represents plain text. and other report items. Colors. colors. doubleclick and then the Placeholder Properties open. A placeholder is created for your field. These steps are visualized in the following diagram: FIGURE 2. d. data regions. b. images. If you use an image field. or around an image. width.73 . In addition to the standard border frames. or to a cell or group of cells within a data region. Lines and Gridlines Borders. lines. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . Using the predefined border styles. for example. By default. matrix. additional border frames can be applied to charts. To format borders and gridlines in a text box. you can quickly add a border around a text box. lines. a text box within the report. You can apply a background image to a rectangle. Images. Fill dialog box. or an image. table. text box. can also be added to the background of your report. In addition. In this dialog box. For example. For example. and gridlines can visually tie items together on the page and help your report readers easily read the contents of the report. you can change the style. you can select a background color for the selected item or you can add an image that appears in the background. right-click the text box and select Text Box Properties. Border. a border along the bottom of a text box. and color for the borders. You can adjust the height and width of the images by changing the display size in the Image Properties. or to the body and page sections of a report. you can adjust the height and width of the images using the Image Properties dialog box. if you want to add a border around an image. Borders are added around the entire item selected or around a border along an edge of the item. and gridlines. Click Fill and then you can select the color you want. a group of text boxes. Border dialog box. Applying Background Colors A solid color can be added to the background of the entire report. however. report layout. Formatting Images Fields that contain images can be added to a data region.Module 2: Interactive Features Borders. you can select a color from the report item's Properties. the images appear in the report with the report is run. right-click the image and then select Image Properties. if you want to change the background color of a text box. use the report item's Properties. When you use the chart. the background color is white. If you use an image in your report layout. you can also specify gradients and pattern styles for background colors. such as logos. Size dialog box. click More colors in the list or click the expression (fx) button next to the list to bring up the Expression editor. Select File.Reporting in Microsoft Dynamics® NAV 2013 Demonstration: Apply a Border to a Chart To give a chart more visual impact. Valid values are between 0.25pt and 20pt. In the dialog box. If you do not see the Chart Properties. g. consider using a border frame around the outside of the chart. h. choose to open the Import Worksheet window. Right-click anywhere on the chart and select Chart Properties. consider defining a page color that is the same color. q. i. The Frame fill color list contains common colors. Demonstration Steps 1. Consider keeping the size of your border to between 1 and 3pt for the best visual effect. Specify the width of the border. Select Border. l. Browse to the report R123456709.fob. Select a value or type an expression that represents the style of the border. m.74 n. The chart border frames cannot be applied to any other data region. o. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Select Tools. e.Chart in design mode. In the Object Designer. In the Action column. If your report contains a background color other than white. specify a style and color for the frame. point to Chart on the shortcut menu and select Chart Properties. Select View. Job Actual to Budget . If you choose a Frame type. and click the type of border to apply to the chart. d. Click Open to start the import. You can select a border frame by using the Chart Properties dialog box or by using the Properties pane. b. The page color is the background color outside of the border line. c. open report 123456709. Object Designer to open the Object Designer. The Line color list contains common colors. Import. Specify the color of the line that will be drawn around the chart as the border. p. Layout to open Microsoft Visual Studio. verify that the action is set to Create. r. Click Open to import the object in the database. k. To apply a border to a chart: a. j. 2 . If you want to select from a list of more colors. f. The selected cells are combined into a single cell. you cannot merge a cell in the data region corner area with a cell in the row group area. click the first cell to merge. For example.75 . drag vertically or horizontally to select adjacent cells.Module 2: Interactive Features Merge Cells in a Data Region You can merge cells in a data region to combine cells. b. To Merge Cells in a data region: a. and body. e. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . open report 123456714 in design mode. In the data region on the report design surface. You cannot merge cells that cross area boundaries. group definition (or row headers). improve data region appearance. or provide spanning labels for column groups and row groups. In the Object Designer. column headers. Repeat steps c and d to merge other adjacent cells in a data region. Right-click the selected cells and select Merge Cells. Cells can only be merged within each area of a data region: corner. d. Demonstration: Merge Cells Demonstration Steps 1. f. Layout to open Microsoft Visual Studio. Select View. c. Holding the left mouse button down. The selected cells are highlighted. g. Reporting in Microsoft Dynamics® NAV 2013 These steps are visualized in the following diagram: FIGURE 2.47: MERGE CELLS WINDOW 2 .76 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Change Background Colors of the Headers and Footers. He wants to have the totals displayed on a group level (with drill down possibilities). Add Visibility Options for the Detail Row.. Have the Salesperson Group Totals Displayed in the Header. 9. He added the necessary groups and also included subtotals and grand totals. Objectives In this lab you will learn how to add interactive features to a report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . 3. 6. Run the Report. to ease report navigation. 4. Add an Information Label to the Customer No. Footer Row. Have the _Document_Type Group Totals Displayed in the Header. Customer No. Kevin wants some additional information added to the report. Change the report so that: 2. 7.77 . 8.Module 2: Interactive Features Lab 2. However.1 Mort finished the rough design of the Sales by Salesperson report. He also wants Mort to use different colors in the headers and footers. Exercise 1: Adding Visibility Options to the Sales by Salesperson Report Exercise Scenario Mort adds the necessary visibility options and the additional information to the report. he wants the Customer Name printed next to the Customer No. Additionally. Document Type Levels. 11.1: Adding Visibility Options Scenario In Lab 1. Have the Customer No Group Totals Displayed in the Footer. 10. Have the Country/Region Code Group Totals Displayed in the Header. Add Visibility Options for the Country/Region Code. 5. Task 1: Adding Visibility Options High Level Steps 1. Add the Customer Name to the Customer Group Header. Subtotals are displayed in the Header rows. the Country/Region Code group will be expanded. In the dropdown menu. Right click on the textbox in which the [Customer__Salesperson_Code_] is shown. select Textbox Properties. f. h.78 Change the report so that: a. c. 2. the Document Type group will be expanded. g. b. Open the RDLC layout of report 123456700 in the Visual Studio Report Designer. g. In the Textbox Properties window change the value of the Name field from Group2 to Customer__Country_Region_Code_ h. the Customer Ledger Entry details will be expanded. b. i. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . By default. select Textbox Properties. The Textbox Properties window opens. In the dropdown menu. a. By clicking the Document Type. Right click on the textbox in which the [Customer__Country_Region_Code_] is shown. d. i. Document Type Levels. In the Textbox Properties window change the value of the Name field from Group1 to Customer__Salesperson_Code_ e. Right click on the textbox in which the [Customer__No__] is shown. This is the textbox located in the first column. Extra information labels such as "Total for XX" are displayed next to the totals. d. third row. select Textbox Properties. The Customer Name is displayed in the Customer Group Header. second row. Customer No. This is the textbox located in the third column. The Headers and Footers have different background colors. Add Visibility Options for the Country/Region Code. The Textbox Properties window opens. By clicking the Customer No. In the dropdown menu. The Textbox Properties window opens. By clicking the Salesperson Code. 2 . By clicking the Country/Region Code.Reporting in Microsoft Dynamics® NAV 2013 Detailed Steps 1.. fourth row. group will be expanded. only the salesperson codes are displayed. the Customer No.. c. f. e. This is the textbox located in the second column. On the Row Groups Tab. fifth row. On the Groups Tab. In the drop-down list box. In the Textbox Properties window change the value of the Name field from Group3 to Customer__No__ k. in the When the report is initially run field. o. Enter a check mark in the Visibility can be toggled by this report item field. select Hide. Enter a check mark in the Visibility can be toggled by this report item field. In the Textbox Properties window change the value of the Name field from Group4 to Cust__Ledger_Entry__Document_Type_ n. in the When the report is initially run field. select Hide. 3. t. select Textbox Properties. aa.79 . Add Visibility Options for the Detail Row. select Hide. This is the textbox located in the fourth column. In the drop-down list box. m. w. In the dropdown menu. s. u. in the When the report is initially run field. a. r. On the Groups Tab. p. select the group4 group and click Group Properties. On the Visibility Tab. y. select the Details and click Group Properties. On the Visibility Tab. Click OK to close the Grouping Properties window. Enter a check mark in the Visibility can be toggled by this report item field. select Customer__Country_Region_Code_.Module 2: Interactive Features j. Right click on the textbox in which the [Cust__Ledger_Entry__Document_Type_] is shown. In the drop-down list box. q. Enter a check mark in the Display can be toggled by this report item field. select the group3 group and click Group Properties. v. On the Groups Tab. select Customer__Salesperson_Code_. select Customer__No__ bb. select Hide. The Textbox Properties window opens. c. Click OK to close the Grouping Properties window. select group2 and click Group Properties. l. x. in the When the report is initially run field. z. b. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . On the Visibility Tab. On the Visibility Tab. Click OK to close the Grouping Properties window. Click twice inside the text box to select the contents. row 2). b. Repeat steps c through f for the Cust__Ledger_Entry__Profit__LCY__ expression (column 7. f. In the dropped-down list box. (column 7. Right-click the selected text and select Summarize by.80 d. Right-click the row handle for the Salesperson Code group footer. Click the drop-down handle for the text box in the Salesperson Code group header row (column 6. The text box now contains the expression: [Sum(Cust__Ledger_Entry__Sales__LCY__)]. Click OK to close the Grouping Properties window. row 3) Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .) e. 5. Click the drop-down handle for the text box in the Customer__Country_Region_Code_header row (column 6. Right-click the row handle for the Customer__Country_Region_Code_ group footer. d. The text box now contains the expression: [Sum(Cust__Ledger_Entry__Sales__LCY__)].) c. f. Click twice inside the text box to select the contents. (The selected context will become blue. Have the Country/Region Code Group Totals Displayed in the Header. Sum. a. Right-click the selected text and select Summarize by. e. row 2) and select [Cust__Ledger_Entry__Sales__LCY__] from the drop-down list box. Repeat steps c through e for the Cust__Ledger_Entry__Profit__LCY__ expression. b. select Cust__Ledger_Entry__Document_Type_. 2 .) c. (The footer will be deleted. Sum.Reporting in Microsoft Dynamics® NAV 2013 4. Select Delete Rows. d. a. (The footer will be deleted. Have the Salesperson Group Totals Displayed in the Header. row 3) and select [Cust__Ledger_Entry__Sales__LCY__] from the dropdown list box. g.) e. (The selected context will become blue. Select Delete Rows. g. row 8) Have the _Document_Type Group Totals Displayed in the Header. Right-click the selected text and select Summarize by. Have the Customer No Group Totals Displayed in the Footer.) c. 8. In the Field list. (The selected context will become blue. In the Build an expression using Visual Basic language syntax. 7. double-click Customer__No__ f.) c. b. followed by the ampersand (&) sign. Repeat steps a through c for the Cust__Ledger_Entry__Profit__LCY__ expression. e. select Fields (DataSet_Result). a. after the equal (=) sign. row 8) b. Sum.Module 2: Interactive Features 6.81 . row 5) Add an Information Label to the Customer No. Click the drop-down handle for the text box in the Cust__Ledger_Entry__Document_Type_ header row (column 6. Right-click the selected text and select Summarize by. row 5) and select [Cust__Ledger_Entry__Sales__LCY__] from the drop-down list box. d. c. Sum. d. a. row 8) and select [Cust__Ledger_Entry__Sales__LCY__] from the drop-down list box. The text box now contains the expression: [Sum(Cust__Ledger_Entry__Sales__LCY__)]. In the group footer row for group 3. (The selected context will become blue. (column 7. In the Category list. Right-click the cell and select Expression. Click the drop-down handle for the text box in the Customer__No__ footer row (column 6. Repeat steps a through e for the Cust__Ledger_Entry__Profit__LCY__ expression. b.Value Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . Click twice inside the text box to select the contents. (Be sure to include the double quotes and add a space before and after the ampersand. (column 7. a. select the fifth cell. The resulting expression should now be: ="Total for Customer " & Fields!Customer__No__. (column 5. Click twice inside the text box to select the contents.) d. enter "Total for Customer ". The text box now contains the expression: [Sum(Cust__Ledger_Entry__Sales__LCY__)] e. Footer Row. e. set the BackgroundColor to Yellow. Click OK to close the Expression window. (fifth row) i.82 a. Change Background Colors of the Headers and Footers. 10. In the Properties window. Run the Report. h. set the TextAlign property to Right. In the Properties window. Click the row-handle for the third group header row. In the Properties window. b. Click the row-handle for the first group header row. while you click the row-handle for the corresponding group footer row. c. Exit Visual Studio. Run menu. set the FontWeight property (in the Font property collection) to Medium. g. Save and import the RDLC changes. a. i. In the Properties window for the cell. 11. In the Properties window. (Now two rows are selected. c. d. In the Properties window for the cell (column 5. 2 . e. Click the row-handle for the fourth group header row. a. set the BackgroundColor to LightSkyBlue. Press the CTRL key. Add the Customer Name to the Customer Group Header.Reporting in Microsoft Dynamics® NAV 2013 9. b. Run the report from the Start. Click the row-handle for the second group header row. set the BackgroundColor to LightGreen. In the textbox in column 4. set the BackgroundColor to LightCoral. the fourth and last row) g. Save and compile the report in the Report Designer. d. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . row 4: select the Customer_Name field in the dataset. and keep it pressed down. f. row 8). h. d. Detailed Steps 1. On the Interactive sorting Tab. Open report 123456700 in Visual Studio Report Designer. Add Interactive Sorting for the Document Type Field. 2.83 . Customer No. Add Interactive Sorting for the Country/Region Code Field. Salesperson Code b. Country Region Code c. c. but with different sorting. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . so that Kevin can change the sorting of the data without having to run the report again.2: Adding Interactive Sorting Scenario After implementing the Visibility options. Add Interactive Sorting for the Customer No. d. 6. Posting Date f. Add interactive sorting for the following fields: 2. 4. Field. b.Module 2: Interactive Features Lab 2. Kevin asks Mort to duplicate the report. a. enter a check mark in Enabled interactive sorting on this text box. Right-click the cell and select Text Box Properties. Add interactive sorting for the following fields: a. 3. Document Type e. Select the first cell in the table header row. Run the Report. Mort presents the new report to Kevin. Mort decides to implement interactive sorting for a number of fields. Objectives In this lab you will add Interactive Sorting for a number of fields. Exercise 1: Add Interactive Sorting for a Number of Fields Task 1: Add Interactive Sorting High Level Steps 1. 7. 5. Profit (LCY) Add Interactive Sorting for the Salesperson Code Field. Add Interactive Sorting for the Profit (LCY) Field. Add Interactive Sorting for the Salesperson Code Field. g. Select the fifth cell in the table header row. Field. f. g.84 e. Group3. a. g. Add Interactive Sorting for the Document Type Field. Add Interactive Sorting for the Country/Region Code Field. 5. Open the report in Visual Studio Report Designer. Click OK to close the Text Box Properties window. select Groups. e. Select the second cell in the table header row. Right-click the cell and select Properties. Click OK to close the Text Box Properties window. c. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . d. e.Reporting in Microsoft Dynamics® NAV 2013 3. enter a check mark in Enabled interactive sorting on this text box. Select the third cell in the table header row. In Choose what to sort:. a. Click OK to close the Text Box Properties window. g. b. In the Sort by expression field. a. select [Customer__Salesperson_Code_]. In the Sort by expression field. In Choose what to sort:. Add Interactive Sorting for the Customer No. Open the report in Visual Studio Report Designer. In the Sort by expression field. f. b. f. On the Interactive sorting Tab. enter a check mark in Enabled interactive sorting on this text box. select [Customer__Country_Region_Code_]. Group1. enter a check mark in Enabled interactive sorting on this text box. In Choose what to sort:. select Groups. Group4. 2 . Right-click the cell and select Properties. Right-click the cell and select Properties. Group2. c. Click OK to close the Text Box Properties window. d. b. d. e. Open the report in Visual Studio Report Designer. select [Customer__No__]. In the Sort by expression field. In Choose what to sort:. select [Cust__Ledger_Entry__Document_Type_]. On the Interactive sorting Tab. c. f. 4. select Groups. On the Interactive sorting Tab. select Groups. Select the last cell in the table header row. a.85 . Run menu. c. Run the report from the Start. In Choose what to sort:. d. c. b. g. e. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . Right-click the cell and select Properties. select Detail rows. b. Save and import the RDLC changes. Exit Visual Studio. f. On the Interactive sorting Tab. d. a. 7. Save and compile the report in the Report Designer. Run the Report. Add Interactive Sorting for the Profit (LCY) Field. In the Sort by expression field. Open the report in Visual Studio Report Designer. Click OK to close the Text Box Properties window. the cell containing the caption for the Profit LCY field. enter a check mark in Enabled interactive sorting on this text box.Module 2: Interactive Features 6. select [Cust__Ledger_Entry__Profit__LCY__]. With this feature. c. The document map should be labeled "Sales by Salesperson". This will appear as a label for the current table (data region control) in the report. users can quickly navigate through the contents of a report. Define a Name for the Data Region Control in the Document Map. Country Code. You will also learn how to add a named document map. Enter "Sales by Salesperson" in the DocumentMapLabels property. a. Run the Report. 4. Add Fields to the Document Map. Detailed Steps 1. Exercise 1: Implement a Document Map in the Sales by Salesperson Report Task 1: Add the Document Map High Level Steps 1. This is convenient if the report contains several tables with a document map. In the Properties window select Tablix1. b.86 Add a document map to the report with the following specifications: a. 2 . Open the RDLC layout of report 123456700 in Visual Studio Report Designer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . you will add a document map to the report. Customer Name. The document map should contain the following data levels: Salesperson Code. Objectives In this lab.Reporting in Microsoft Dynamics® NAV 2013 Lab 2. a built-in feature of Microsoft SQL Server Reporting Services. Add a document map to the report with the following specifications: 2. 3. b. Meanwhile. Mort has learned about document maps. so Mort decides to implement a document map in the Sales by Salesperson report. 2. Mort notices that Kevin focuses his attention mostly on the report navigation.3: Adding a Document Map Scenario During his conversations with Kevin. Define a Name for the Data Region Control in the Document Map. d. select [Customer__Salesperson_Code_] in the Document map field. Save and compile the report in the Report Designer. select [Customer__No__] in the Document map label field. On the Advanced Tab. Click OK to close the Grouping Properties window. select the group3 and click Properties. d. Save and import the RDLC changes. Click OK to close the Grouping Properties. Run menu.Module 2: Interactive Features 3. On the Row Groups Tab. Exit Visual Studio. b. g. a. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . On the Row Groups Tab. b. select the group1 and click Group Properties. h. Run the report from the Start. a. On the Advanced Tab. i. The Grouping Properties window will appear. On the Advanced Tab. select [Customer__Country_Region_Code_] in the Document map field. 4. select the group2 and click Properties.87 . f. Run the Report. c. On the Row Groups Tab. Click OK to close the Grouping Properties window. The Grouping Properties window will appear. c. e. The Grouping Properties window will appear. Add Fields to the Document Map. should be included. Add a Page Header Section to the Report. address. Change the Layout of the Table Header Cells. You will use embedded images and database pictures. you will work with pictures. The list should also include pictures of the items.Reporting in Microsoft Dynamics® NAV 2013 Lab 2. The report should have a header (printed on all the pages).88 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .4: Adding Pictures to a Report Scenario Michael. because not all items have pictures. you will add a report header and add data fields to the header. Add Text Boxes for the Company Information to the Page Header. 6. Additionally. Exercise 1: Create an Item Catalog Report Task 1: Add Images to the Report High Level Steps 1. Additionally. city. 14. 13. Set the Format for the Unit Price Field. postal code. Embed the Company Logo Picture in the Report. the header should contain the CRONUS company logo as an embedded picture. 4. 11. Apart from the report title. you will include the picture as a hidden field that can be made visible when the user clicks the Item No. Export the Company Logo from the Demonstration Database. Run the Report. Create the Table in the Report Layout. However. Import the Object. company name. Create an Item Catalog report with the following specifications: 2. the Account Manager. Michael arranges a meeting with Mort to explain the specifications of the Item Catalog. Objectives In this lab. Michael wants to provide the customer with an Item Catalog. 2 . 7. 8. 9. Add the Picture Field to the Table. Add the Report Title to the Page Header. country and value added tax (VAT) Registration No. 3. 10. To give the customer advanced information. must visit with a new customer. Set the Format for the Inventory Field. Set the Visibility for the Picture Field. the basic company information such as. 12. 5. Unit Price. postal code. address. Create an Item Catalog report with the following specifications: a. a. Close the Company Information window. Description. c. Base Unit of Measure. verify that the action is set to Create. Open the CRONUS International Ltd. Click OK to start the import. In the dialog box. a. Right-click Picture. 2. Save As. a. Import the Object. Select Tools. h. b. c. Object Designer to open the Object Designer. d. The Picture can be made visible by clicking the Item No. Inventory and Picture. The header contains the report title. Import. select No_Item and drag it to the first cell in the table detail row. e. basic company information (company name. 4. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . Click OK to import the object in the database. Add a table to the Body section. Add two columns to the table. b.89 . d.bmp) on the Windows desktop.. Export the Company Logo from the Demonstration Database. Open report 123456724 in Visual Studio Report Designer. Open the Microsoft Dynamics NAV 2013 demonstration database. choose to open the Import Worksheet window. Save the company logo as a bitmap (cronus. Create the Table in the Report Layout. country and VAT Registration No. b. run page 1. Select File. f. Company Information. d. Browse to report R123456724. e. c. 3. In the Object Designer. In the Website Data Sources window. The body contains the following item information: No. company in Microsoft Dynamics NAV. b. In the Action column. c.) and the Cronus logo (as an embedded picture). city. The header must appear on all the pages.Module 2: Interactive Features Detailed Steps 1. g. select the proper format code using the Expression window: =Fields!Inventory_ItemFormat. c. 6. g.Value. select the cell containing the [Inventory_Item]. 8. d. enter below format code in Expression window: =Fields!UnitPrice_ItemFormat. a. c. select Inventory_Item and drag it to the fifth cell in the table detail row. Set the Format for the Unit Price Field. In the Website Data Sources window. Set the FontWeight property (in the Font collection) to Bold. Click the row handle for the table header row. In the Website Data Sources window. select BaseUnitofMeasure_Item and drag it to the third cell in the table detail row. select Description_Item and drag it to the second cell in the table detail row.Value d. Change the Layout of the Table Header Cells. e. From the Toolbox window drag an Image control to the new column. a. f. In the Image Properties window. set the Select image source property to Database. On the table detail row. Add the Picture Field to the Table. Right-click the cell and select Properties. Add a column to the right side of the table. On the table detail row. h.90 Click OK to close the Text Box Properties window. 2 . Set the Format for the Inventory Field. b. On the properties window. Right-click the cell and select Properties. a. Click OK to close the Text Box Properties window. select the cell containing the [Unit_Price_Item]. c. c. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . On the Format Tab. b. b. click Custom in right panel. Set the VerticalAlign property to Bottom. select UnitPrice_Item and drag it to the fourth cell in the table detail row. In the Website Data Sources window. select Number tab. b. 7. a. In the Website Data Sources window. in the Format Code field.Reporting in Microsoft Dynamics® NAV 2013 5. select Add Page Header in case there is none present in the report. set the Use this MIME Type property to image/bmp. e. Add six new text boxes to the Page Header. Add Text Boxes for the Company Information to the Page Header. Browse to the Windows desktop and select cronus. Select the CompanyName in the Report Dataset and drag it onto the first text box. c. In the Toolbox window. In the Image Properties window. b. 12. in the Visibility property collection. Add the Report Title to the Page Header. Select the CompanyAddress in the Report Dataset and drag it onto the next text box. Set the value property to "Item Catalog". b. 13. In the Report Data Tab.Module 2: Interactive Features 9. d. set the Hidden property to True. Select the Text box control. Set the Visibility for the Picture Field. Set the Color property to RoyalBlue. click the OK button. select the CRONUS image you just added and drag it onto the page header. select the Text box control and insert it in the top left corner of the page header section. Add a Page Header Section to the Report. b. d. Set the FontSize property to 18pt. c. a. In the Properties window.91 .bmp. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . b. a. In the Report menu. select the Images folder. 11. 10. c. In the Properties window. Embed the Company Logo Picture in the Report. a. b. In the Image Properties window. set the ToggleItem property to No_Item. e. Click OK to import the picture in the report. Right-click and select Add Image. a. a. In the Image Properties window that opens. In the Images folder. c. set the Use this image property to [Picture_Item]. d. in the Visibility property collection. Save and compile the report in the Report Designer. 2 . Run the Report. e. Select the CompanyCity in the Report Dataset and drag it onto the next text box. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . d. Select the CompanyVATRegistrationNumber in the Report Dataset and drag it onto the next text box.Reporting in Microsoft Dynamics® NAV 2013 d. g. Run menu. b.92 a. Select the CompanyCountryRegionCode in the Report Dataset and drag it onto the next text box. c. Save and import the RDLC changes. Exit Visual Studio. Run the report from the Start. Select the CompanyPostCode in the Report Dataset and drag it onto the next text box. 14. f. Test Your Knowledge Test your knowledge with the following questions.93 . Which header sections are not supported by Visual Studio Report Designer? ( ) Page Header ( ) Group Header ( ) Transport Header ( ) Table Header 2. document maps and different types of images. you learned how to use interactive sorting. Which properties are not supported by Visual Studio Report Designer? ( ) FixedRowHeaders ( ) RepeatColumnHeaders ( ) Keeptogether ( ) PlaceInBottom ( ) LayoutDirection Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 . • Apply visibility options. The most important aspects covered in this module are: • Adding groups in a tablix data region. Additionally. 1. • Using images in a report. interactive sorting and document maps.Module 2: Interactive Features Module Review Module Review and Takeaways In this module you learned how to work with the enriched functionalities of the new reporting solution. • The difference between print preview and print layout. visibility options. This module also described the different types of headers and footers and how to activate them. Which controls cannot be added to a Page Header section? ( ) Chart ( ) Line ( ) Text box ( ) Rectangle ( ) Image 2 . Which is not a valid option for the Source property of an image control? ( ) Internal ( ) External ( ) Embedded ( ) Database 5.Reporting in Microsoft Dynamics® NAV 2013 3. In which windows can you delete a group? ( ) Properties window ( ) Table Properties window ( ) Row Groups window ( ) Header Properties window ( ) Toolbox window 4.94 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Which properties can be used to set the background and the foreground color of a control? ( ) BackgroundColor and ForegroundColor ( ) BackgroundColor and TextColor ( ) BackgroundColor and Color ( ) BackgroundColor and CellColor Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 .Module 2: Interactive Features 6.95 . Which of the following statements is true? ( ) Database images can only be visualized in the Report Body Section ( ) Database images can only be visualized in the Report Header or Footer Section ( ) Database images can be visualized in all sections of the report ( ) None of the answers is correct 7. 96 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Which properties are not supported by Visual Studio Report Designer? ( ) FixedRowHeaders ( ) RepeatColumnHeaders ( ) Keeptogether (√) PlaceInBottom ( ) LayoutDirection 3. Which is not a valid option for the Source property of an image control? (√) Internal ( ) External ( ) Embedded ( ) Database 2 . In which windows can you delete a group? ( ) Properties window ( ) Table Properties window (√) Row Groups window ( ) Header Properties window ( ) Toolbox window 4. Which header sections are not supported by Visual Studio Report Designer? ( ) Page Header ( ) Group Header (√) Transport Header ( ) Table Header 2.Reporting in Microsoft Dynamics® NAV 2013 Test Your Knowledge Solutions Module Review and Takeaways 1. Which properties can be used to set the background and the foreground color of a control? ( ) BackgroundColor and ForegroundColor ( ) BackgroundColor and TextColor (√) BackgroundColor and Color ( ) BackgroundColor and CellColor Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 2 .97 .Module 2: Interactive Features 5. Which of the following statements is true? ( ) Database images can only be visualized in the Report Body Section ( ) Database images can only be visualized in the Report Header or Footer Section (√) Database images can be visualized in all sections of the report ( ) None of the answers is correct 7. Which controls cannot be added to a Page Header section? (√) Chart ( ) Line ( ) Text box ( ) Rectangle ( ) Image 6. 98 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Reporting in Microsoft Dynamics® NAV 2013 2 . start by defining the data model for the report. by filling in the data item(s) in the Report Dataset Designer. for every data item there are also triggers available. In addition to properties.MODULE 3: ADDING CODE TO A REPORT Module Overview When you create reports in Microsoft Dynamics® NAV. Triggers can contain C/AL code that is executed when the trigger occurs. The report includes the following triggers: • OnInitReport() • OnPreReport() • OnPostReport() For every data item that you add in the DataItem designer window the following triggers are available: • OnPreDataItem() • OnAfterGetRecord() • OnPostDataItem() The request page of a report has the following triggers: • Documentation() • OnInit() • OnOpenPage() • OnClosePage() • OnFindRecord(Which : Text) : Boolean • OnNextRecord(Steps : Integer) : Integer • OnAfterGetRecord() • OnNewRecord(BelowxRec : Boolean) • OnInsertRecord(BelowxRec : Boolean) : Boolean • OnModifyRecord() : Boolean • OnDeleteRecord() : Boolean • OnQueryClosePage(CloseAction : Action None) : Boolean • OnAfterGetCurrRecord() Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3-1 . • Learn how to use expressions. Expressions are related to properties in RDLC reports. An RDLC report layout does not contain triggers. Objectives The objectives are: 3-2 • Explain how coding can be used in reports. you can use expressions. • Work with expressions. This module will focus on the important features that you must know to be able to develop RDLC reports.Reporting in Microsoft Dynamics® NAV 2013 The controls on the request page each have the following triggers: • OnValidate() • OnLookup(VAR Text : Text) : Boolean • OnDrillDown() • OnAssistEdit() • OnControlAddIn(Index : Integer. triggers are typically used to perform calculations and to control whether to output sections.Data : Text) In reports. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Instead. • Examine frequently used expressions. You can use triggers to control how data is selected and retrieved in a more complex and effective way than you can achieve by using properties. • Describe the components of the Sales Invoice report. Top X (where X can be a number selected by the user such as Top 5. This trigger performs any processing that is required before the report is run. Top 10). The code is used for advanced report functionalities that cannot be achieved by using properties. The information from the Request page is stored in variables that are evaluated in runtime. But not all code is written on the data item level. You can use triggers to control how data is selected and retrieved in a more complex and effective way than you can achieve by using properties. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3-3 . Additionally. Show Sales (LCY) or Balance (LCY). Code can be written using the C/AL Editor on different levels: • Report triggers • Data item triggers • Request page triggers • Request page control triggers Previous modules described how the logical design of a report applies to Report Definition Language Client-side (RDLC) report layouts. the code will be reflected in the dataset that is generated. you can also add code. Print amounts in Local Currency.Module 3: Adding Code to a Report Using Variables and C/AL Code in a Report The reports built in the previous modules are designed by using the designers. Well-known options include the following: Show details. Many reports have a request options page that uses options that affect the way a report is printed. controls and properties. triggers are typically used to perform calculations and verification. OnInitReport This trigger is executed before the Request page is run and before any table views or filters are set. the code can be used for retrieving and calculating data. but also for formatting purposes (and dynamically hiding and showing data sections). Report Triggers In reports. such as initializing global variables. If you use code to filter or sort a specific data item. It can also stop the report. In reports. if it is the last data item of the report. 3-4 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . As this trigger is executed after the Request page is processed. because this trigger is executed before the End Write Transaction. Additionally. you can update all the records with the modification date as follows: MODIFYALL("Modification Date". The trigger is not run if the report is stopped manually or if you are using the QUIT function before processing has concluded. you can also give the user the opportunity to roll back changes to the database by leaving the report that has the QUIT. You can use this trigger to add more filtering beyond what is established by the DataItemLink property (Reports) or DataItemTableView property. you have access to any filters the user has set. and after the associated variable is initialized and table views and filters are set. you can retrieve them by using the function: String := Record. If you want to print the settings of these filters in the report. The table views and filters for the report data items are set while this trigger is executed. Because this trigger is executed after the report is processed. For example.TODAY). Use the SETRANGE or SETFILTER function to add more delimiters. function. OnPreDataItem This trigger is executed before a data item is processed. Use this trigger to perform any cleanup or post processing that is required after a data item is processed. use this trigger if you have to filter an indented data item based on the result of a calculation. OnPostReport This trigger is executed after all data items are processed. if you create a nonprinting report where records are updated. you can use it to inform users about the result of the report run.Reporting in Microsoft Dynamics® NAV 2013 OnPreReport This trigger executes after the Request page is run. OnPostDataItem This trigger executes after the last record in the data item is processed but before the OnPostReport trigger is executed. For example.GETFILTERS and then by using the text string as the source expression for a control in a section of the report. You use this trigger to retrieve the information so that you can print it in your report. you must recalculate the FlowFields after you have applied the FlowFilters. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3-5 . you can put CALCFIELDS statements in this trigger to have them calculated.Module 3: Adding Code to a Report OnAfterGetRecord Use this trigger to perform any processing that is required. there are situations where you have to use this trigger to perform the calculation explicitly. For example. Although it is typically easier to use the CalcFields property to have it done automatically. However. If the record contains FlowFields. you want to print the full name and address of the vendor. Another example is when you must retrieve information from a table that is external to the report. if you apply FlowFilters based on the context of the report to the FlowFields inside this trigger. in a report. based on the values in the fields of the individual records of a data item. the records in a data item might contain a field that has a Vendor code. This is the situation when the records of a data item contain fields that are foreign keys (meaning the fields that are primary keys in other tables). For example. and you want to extract additional information from the related tables. for example. 3-6 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . the next data item is processed in the same manner. At this point. FIGURE 3. the OnInitReport trigger is called. When the OnPreReport trigger is executed. On the request page. If the OnInitReport does not end the processing of the report.Reporting in Microsoft Dynamics® NAV 2013 Trigger Execution Order When you run a report. When the first data item is processed. removing temporary files. no data is processed. When there are no more data items. The ReportTriggersExecution figure describes the order in which report triggers are executed. The page triggers for the request page are called. If you decide to continue. the OnPostReport trigger is called to do any necessary post processing. then the OnPreReport trigger is called. you select the options that you want for this report. the report triggers are called in a specific order. the first data item is processed if the processing of the report is not ended in the OnPreReport trigger. if it is defined. then the request page for the report is run.1: REPORT TRIGGERS EXECUTION ORDER When you start the report run. You can also decide to cancel the report run. How a Data Item is Processed Before the first record is retrieved. you cannot start the function that is defined in the report directly. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3-7 . the value is printed as "true" or "false" in the target language. when a Boolean value appears on a report. then the records in this data item are processed. the OnAfterGetRecord (Data Items) trigger is called. you might want to change the printed value of a Boolean variable in a RDLC report layout to "yes" or "no" instead of "true" or "false. or by using an expression to define the format of the date. You can set the format in the report by using the FORMAT() function. When there are no more records to be processed in a data item. then control returns to the report. By default. one defined in a report and the other in a table that is referenced by the report. Processing a record means executing the record triggers and outputting data. In some cases. If there is an indented data item. You can use a similar procedure for the boolean variables to verify or change the format of a date. "No". The same applies to date values. Between these two triggers. or you set the Value property of the text box in the RDLC report layout to an expression such as =IiF(Fields!BooleanVariable. the OnPreDataItem trigger is called. this means the next record of the data item on the next highest level. "Yes"). Check the Value of Printed Variables In a RDLC report layout. and after the last record is processed.Value = False. If the data item is already on the highest level. When you create a RDLC layout for a report. the OnPostDataItem trigger is called. you must modify date values so that they are formatted correctly. the data item records are processed. a call to the function invokes the function that is defined in the table." This can be performed in two ways: either you change the SourceExpr property of the text box that displays the Boolean variable to FORMAT(BooleanVariable). This behavior occurs when the function is called from a source expression or a trigger. After a record is retrieved from the data item. control returns to the point from which processing is initiated. For an indented data item.Module 3: Adding Code to a Report Note: If you define two functions that have the same name. For example. there’s integer variable called ShowTypeNo. Demonstration: Using Option Strings in Multilanguage Implementations In a RDLC report layout. a. A RDLC report layout does not provide the following functionality: strings will be handled as normal strings. click Report. On the View menu. ShowType.Reporting in Microsoft Dynamics® NAV 2013 Best Practice: In the C/AL code. on the Tools menu. In the development environment. b. c. The value of the ShowType variable is assigned to an integer variable. and then click Design. You must manually convert the option string to an integer variable and then use the integer variable in the RDLC report layout. there’s a line of code in the OnAfterGetRecord trigger of the Customer Data Item to assign the option string to an integer value. Customer -Top 10 List 2. You can use this option variable to select to display either Sales (LCY) or Balance (LCY) in the report. select C/AL Globals. In the C/AL Globals window. in the OnAfterGetRecord trigger. d. not an option string. The request page has an option variable. On the report. an option variable is handled as a typical string. It is recommended that you work with the numeric value of the option variables in the RDLC report layouts so that multilanguage functionality will not be an issue. e. ShowTypeNo. Customer Top 10 List. If you have a Multilanguage application. An example of a report that uses an option variable that is converted to an integer variable is report 12345671. You use this variable for the integer value of an existing option variable. you have an option variable on the request page named ShowType. on the Variables tab. you can use both the numeric value and the text representation to check the value that is selected for an option variable. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Demonstration Steps 1. 3-8 In the C/AL Editor. there’s an integer variable. In Object Designer. select the report that you want to modify. click Object Designer. handling the option as a normal string will cause problems in the displayed report. Assign the option string to an integer variable. in report 12345671. Demonstration Steps 1. select the report that you want to modify. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3-9 . In Report Dataset Designer. Change the printed value of a Boolean field. you have the following line of code. In Object Designer. select the report for which you want to change the printed values of Boolean variables or fields. b. click Report.rdlc file. In the development environment. add a Column with ShowTypeNo as the value of the Data Source field. In the Data Source field. 2. In Microsoft Visual Studio. the ShowTypeNo integer variable is used in expressions on the bar chart and the pie chart. use the integer variable instead of the option variable. select the Compiled check box. a. In some cases. the value is printed as "True" or "False" in the target language. In Report Dataset Designer. g. a. Demonstration: Change the Printed Value of a Boolean Field. c. In the Save window. such as in expressions. click Object Designer. ShowTypeNo := ShowType. change the <BooleanVariable> to FORMAT(<BooleanVariable>). On the File menu. In report 111. h. c. select Save. On the View menu. click Report. when a Boolean value appears on a report. f. in report 12345671. select Layout. You can change the value to "Yes" or "No" instead of "True" or "False". In Object Designer. Use the integer variable instead of the option string in the layout.Module 3: Adding Code to a Report For example. b. you might want to change the printed value of a Boolean variable or field in a RDLC report layout. in the Report. In a RDLC report layout. on the Tools menu. and then click OK. find the column for the Boolean variable or field that you want to change. d. and then click Design. and then click the Design button. e. select the format variable from the list. b. in report 12345671 you could apply this for the field Customer. In Object Designer.Value. On the File menu. in the report. d. f. you must manually specify to use the format variable for the formatting. In the Expression window. On the View menu. select the Compiled check box. on the Tools menu. Demonstration: Format Decimal Values When you create RDLC layout for a report. click Fields (DataSet_Result). g. f. For example. right-click the text box that displays a decimal value. select Custom. In the Category list. if the Value field on the General tab is =Fields!Customer__Sales__LCY__. The format information from the Column properties in Report Dataset Designer is stored in the format variable. In the Text Box Properties window. Demonstration Steps 1. click Object Designer.rdlc file. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . select a report that you want to modify. a.10 Format decimal values. Decimal values are formatted in the RDLC layout by using the format variable. For example. In Visual Studio. select Save. and then click Design.Reporting in Microsoft Dynamics® NAV 2013 e.Value. h. select Layout. c. g.Blocked. a format variable is created for each decimal variable. In the Save window. and then click OK. then in Visual Studio Report Designer. 3 . and then click OK. and then click the function button (fx) next to the custom format field. select the Number tab. and then select Text Box Properties. select Report. In the development environment. If you create controls that use decimal values in a RDLC report layout. then the expressions for the format on the Number tab should be =Fields!Customer__Sales__LCY__Format. expressions are used to obtain the following kinds of functionality in your report: • Aggregations on data to show the sum. On the File menu. They can be used for data manipulation (retrieve. • Data filtering (after it is retrieved from the data source). In most cases. d. select a report that you want to modify. e. Expressions are used to provide dynamic flexibility for controlling the content and appearance of a report. • Concatenated text from multiple dataset fields and constants. and then click OK. format. Use the parameters of the FORMAT function to specify the length and the exact format that you want for the date. f. click Save. In the development environment. group. For example. In the Save window. • Dynamic page header and page footer content.11 . or product of a particular rowset. enter FORMAT(TODAY. a. • Conditional formatting. on the Tools menu. c. and then select Design. where a report title varies. Demonstration Steps 1. Format date values.0. instead of entering TODAY in the Data Source field. where text or background formatting changes based on logic that you define.4). Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . • Data grouping and sorting. sort and filter data) and formatting. b.Module 3: Adding Code to a Report Demonstration: Format Date Values You can modify date values in Report Dataset Designer to specify how they are formatted in the layout of a report. select the Compiled check box. in the Data Source field of a Column that contains a date. In Report Dataset Designer. use the FORMAT function that has the date. click Report. In Object Designer. depending on who is running the report. percentage. average. • Conditional text. Working with Report Expressions Expressions are widely used in a report for various purposes. click Object Designer. calculate. and syntax checking.Reporting in Microsoft Dynamics® NAV 2013 On the report design surface. and function calls combined with simple expressions. 3 . Expressions are created by using Microsoft Visual Basic language syntax. Simple expressions contain a reference to a single dataset field or built-in field. or you can type them directly into a data region cell or text box on the design surface. During report processing. or by typing the expression syntax directly into a text box. How to Create Expressions You can create expressions in a report definition by using the Expression window.12 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . functions. statement completion. sort and filter expression field. Knowing how to create and use expressions is a fundamental skill that will help you create rich full-featured reports. each expression evaluates to a single value that replaces the expression when a report is rendered. a property in the Properties window. Other than a large work area. Using the Expression window has many advantages over manually entering the expressions. An expression is written in Microsoft® Visual Basic®. operators. An expression begins with an equal sign (=) and consists of references to dataset fields. or a group. Simple expressions are created for you automatically (for example. operators. Complex expressions can contain multiple built-in references. and other built-in report collections. expressions appear as simple or complex expressions. it offers context-sensitive global collection item choices. when dragging a field from a dataset onto a text box). constants. shows the current expression for the selected text box or property. the Item pane. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . the Example pane displays an example of the selected item.13 . the Field pane will be replaced by the Description and Example panes. For example. Which panes appear depends on the selected Category. FIGURE 3. The top pane. At the right side you can have one large pane. the Field pane. The contents of the pane are updated when a new category is selected in the Category pane. the following dialog box appears. The Description pane shows a description of the selected Item. The bottom middle pane.Module 3: Adding Code to a Report The Expression Editor When you open the Expression window. The Field pane contains all elements that are available in the selected Item and Category. contains all items that are available in the selected category. It is divided into a number of panes. The contents of the Field pane are updated when you select a new Item. You can edit the expression in the pane by using the keyboard and by double-clicking items in the bottom panes. If the selected Item has no fields.2: THE EXPRESSION WINDOW The Expression window can be used to add and edit expressions. the Expression pane. However. UserId and Language. the Globals category contains items such as ExecutionTime. or two smaller panes (the Description and the Example pane). You can open the Expression Editor for the following items: 3 . When you build an expression. and the Example pane shows the syntax of the selected function. you can build additional expressions by using Microsoft Visual Basic language syntax. you can use the Expression window to edit only one expression at a time. In some windows (for example. you can double-click any element in the bottom panes to have it inserted automatically in the Expression pane. colored syntax and syntax checking so that you can easily detect syntax errors. statement completion. You can move and resize the Expression Editor to have a larger work surface.Reporting in Microsoft Dynamics® NAV 2013 For example. on the Sorting tab in the Table Properties window) you can create multiple expressions that will be combined during report processing. The Description pane will show a small description of the selected Item. the Item category will show the three functions in the category. As the Expression pane suggests. Accessing the Expressions Window The Expression editor can be accessed in various ways. depending on the current position in the Visual Studio Report Designer. The Expression pane supports features such as IntelliSense. data regions. However. or data region groupings • Document map label on a data region group • Parent group on a data region group Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .14 • Text box on a report • Property in the Properties page • Groups tab on data region properties • Sorting tab on data region properties • Filter tab for datasets. when you select the Program Flow category (under Common Functions). 3: EXPRESSION SHORTCUT IN TEXT BOX WINDOW Several properties in the Properties window. you can right-click any text box control and select Expression. BackgroundColor and Value. FIGURE 3. such as Visibility. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . as is shown in the Expression Shortcut In Text Box figure. support both fixed options and expressions as a first option in the drop-down list.15 .Module 3: Adding Code to a Report On the design surface. Select <Expression> in the drop-down list to enter an expression in the Value column for a property. expressions can be either selected directly from a drop-down list. The Aggregate implementation is supplied by each data provider.4: EXPRESSION SHORTCUT IN BACKGROUNDCOLOR PROPERTY WINDOW Expressions can also be entered in various dialog boxes such as the Grouping and Sorting Properties and the Tablix Properties window. In these windows. on the General tab. Functions that provide aggregate values on report items. the fx button is available to define Tooltips. you must identify to the report processor so that the function calls can be resolved during report processing. Items Reporting Functions 3 .16 Description of functions and how to reference them Built-in. and which references. Valid Expression References The following table shows the types of references that you can include in a report expression. or they can be entered by clicking the fx button to set specific properties. For example. and other utility functions that support aggregation. The table indicates which of these references are built-in.Reporting in Microsoft Dynamics® NAV 2013 FIGURE 3. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . in the Table Properties window. you can add the custom code (variables. You can define public constants. select Report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . procedures. and so on) to enrich your report. On the Code tab. System. For example.Math Built-in. System.Text. Code tab. System. and functions for your use in each report definition. • Globals • User • Fields • ReportItems • Datasets • Parameters Custom Code Built-in. you can add code or external references to your report. variables. functions. Visual Basic Runtime Library Built-in.Module 3: Adding Code to a Report Items Reporting Collections Description of functions and how to reference them Built-in. To add custom code to your report.Convert Built-in.NET Framework (common language runtime) Classes Add fully qualified references in your expression.17 . and then select Report Properties in Visual Studio Report Designer.StringBuilder In addition to the use of the built-in functions. to add more functions. subroutines. Add your Visual Basic code through the Report Properties menu. . For example. the FontName property of a text box can have several constant values. Tahoma. several functions are automatically added to the Code tab. variables and constants to build a more complex expression. This indicates that the statement following the equal sign is an expression that will be evaluated by the reporting engine.5: THE CODE TAB OF THE REPORT PROPERTIES WINDOW The functions that are added all relate to the presentation and formatting of data." (period). 3 . use the =Fields("FieldName"). such as Arial. to refer to the value of a specific field (in the Fields collection). Expression always start with the "=" sign. An element and its properties are always separated by a ". Verdana. use the standard Visual Basic syntax. To refer to a collection or element from an expression.Value. and so on.18 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In this case the (parent) collection and the (child) element are concatenated by an exclamation mark. You can also use a combination of functions. it is recommended that you do not include code that is part of the report's business logic. An alternative way to reference the same value is to use =Fields!FieldName. The Width property is less restrictive: the values are not predefined.Value expression. Although you can add any code to the report by using the Code tab.Reporting in Microsoft Dynamics® NAV 2013 When you open Visual Studio Report Designer to create a report. For example. FIGURE 3. Most expressions consist of a single constant value. you can also add custom assemblies and classes to reports. select Build Solution. the error indicates a typing error in the Value expression for the field Name_Customer: Code example =Fields!Name_Cstomer. syntax errors do not prevent you from importing the RDLC data into Microsoft Dynamics NAV. When you use Visual Studio Report Designer. In the Build Menu. More information about how to create trusted managed assemblies can be found on: http://msdn. FIGURE 3. some errors in the RDLC report layout might be indicated. only trusted managed assemblies are supported.Value Should be =Fields!Name_Customer. However. When you try to save and compile the report in the Object Designer.com Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 .Value Note: Other than the items in the previous table.microsoft. Other errors might appear when the report is run. However.6: ERROR LIST IN VISUAL STUDIO REPORT DESIGNER SCREEN SHOT In the Error List in Visual Studio Report Designer figure. you can also check for errors. if an incorrect syntax for the IIF() statement is used. For example.Module 3: Adding Code to a Report Syntax errors are detected and indicated automatically. or if the Value property of a text box in the Page Header section is set to a data field from the dataset. you will receive an error message. The Error List in Visual Studio Report Designer figure shows an example. The report is parsed for syntax errors and if any are found a message is displayed at the bottom of the window in the Error List.19 . The following table shows examples of display and expression text. 3 . Understanding Display Text for Expressions Simple expressions use symbols to indicate whether the reference is to a field.Value [SUM(Sales)] =Sum(Fields!Sales. The report processor has access to the predefined constants so that when you include them in an expression.Label Built-in fields [&ReportName] =Globals!ReportName. Knowing how to create and use expressions is a fundamental skill that will help you create rich full-featured reports.Reporting in Microsoft Dynamics® NAV 2013 Understanding and Using Simple and Complex Expressions The previous lesson described how expressions are widely used in reports for various purposes.Value) [FIRST(Store)] =First(Fields!Store. a parameter. Item Dataset fields Display text example Expression text example [Sales] =Fields!Sales. or the ReportItems collection.20 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Value Literal characters that are used for display text \[Sales\] [Sales] Complex expressions <<Expr>> ="Page " & Globals!PageNumber & " of " & Globals!TotalPages Report parameters Using Constant Collections in Expressions A constant consists of literal text or text that is predefined. the values they represent are substituted in the expression before it is evaluated. a built-in collection.Label] =Parameters!Param.Value [@Param.Value) [@Param] =Parameters!Param. This lesson will describe the different data collections that can be used in expressions. literal text is text that is in double quotation marks. When you select the Color property of a text box. In the Expression dialog box. Italic Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . The following table shows several examples of literal text in an expression. Constant Display text Expression text Report run at: <<Expr>> ="Report run at: " & Globals!ExecutionTime CRONUS International Ltd. The following table shows two examples. Default. Overline.Module 3: Adding Code to a Report The Constants collection is mostly used in simple expressions. Property Description Values TextDecoration Specifies special text formatting such as underlining. Normal. also known as enumerated types. LineThrough FontStyle Specifies the style of the font. If the text box value does not begin with an equal sign (=). Literal Text In an expression. The content of the Constant category depends on the selected property. When you select the Hidden property (in the Visibility property collection).21 . constants appear when you create an expression for a report property that only accepts certain valid values. CRONUS International Ltd. [Bracketed display text] \[Bracketed display text\] [Bracketed display text] RDL Constants You can use constants defined in Report Definition Language (RDL) in an expression. None. You can also type text directly into a text box without double quotation marks if it is not part of an expression. Underline. Default. it contains the possible colors. Simple expressions are frequently used to set properties throughout the report. the text is treated as literal text. the category contains two constants: True and False. CRONUS International Ltd. 2008. The following table shows two examples.Globals!ExecutionTime) CLR Constants You can use constants defined in the . the following function returns the number 10: =DatePart("d".22 Description When you create an expression for a report property that is based on background color. the following expression shows the time stamp for report processing and the user on two lines in a single text box: =Globals!ExecutionTime & vbCrLf & User!UserID DateInterval.NET Framework common language runtime (CLR) classes in an expression. Constant vbCrLf Description The Visual Basic constant for a carriage return followed a new line. For example. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . for the date January 10.Reporting in Microsoft Dynamics® NAV 2013 Visual Basic Constants You can use constants defined in the Visual Basic run-time library in an expression. The following table shows an example of a system-defined color. Constant MistyRose 3 . For example. Valid names are listed in the Expression dialog box. you can specify a color by name.Day The Visual Basic constant that you use to designate the day part of a date time value in a DatePart function call. 23 . b. Type the following expression: =Globals!ExecutionTime & vbCrLf & User!UserID The Expression With A Constant figure shows the expression.Module 3: Adding Code to a Report Demonstration: Using a Constant in the Report Header Mort is creating a new report. He adds a Page Header to the report and will now add a text box that contains the execution time and user ID. FIGURE 3. To show both values in one text box he uses the constant VBCRLF. Demonstration Steps 1. The Expression Designer window opens.7: EXPRESSION WITH A CONSTANT WINDOW Using Global Collections in Expressions The following global collections can be referenced from expressions: • Constants • DataSets • DataSources • Fields Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . add an expression to show the execution time and user ID: a. In the newly added text box. Right-click the text box and select: Expression. c. or page footer.Reporting in Microsoft Dynamics® NAV 2013 • Globals • Parameters • ReportItems • User The following table describes each global collection and explains when you can reference the collection from an expression. User!UserID is frequently used to filter results in reports. User Represents a collection of data about the user running the report. such as the language setting or the user ID. Does not include data sources used only in page headers or page footers. such as the text boxes that are contained in a table data region.24 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Always available. Always available. Available after data is retrieved from Microsoft Dynamics NAV into the dataset. Global Collection Fields Description Represents the collection of fields of the dataset that are available to the report. DataSets Represents the collection of datasets referenced from the body of a report definition. page header. Globals Represents global variables useful for reports. User!Language is used to make specific settings dependent on the language of the user. More detailed information about some frequently used functions is described in the next lesson. ReportItems Represents the collection of text boxes for the report item. Parameters Represents the collection of report parameters when you use Labels or use the IncludeCaption property. Available during report processing. 3 . such as the report name or page number. To convert data that has multiple numeric data types to the same data type.Module 3: Adding Code to a Report Using Report Functions in Expressions Report Viewer provides a set of built-in functions that you can include in an expression. Date and Time.25 . you can view the most frequently used functions in the Expression dialog box. Function Description Aggregate Returns a custom aggregate of the specified expression. and return other data. Built-in functions are used to aggregate data in datasets. and other areas in the report. For convenience. Min Returns the minimum value from all non-null values of the specified expression. You can use built-in functions within expressions to manipulate the data within report items. CountDistinct Returns a count of all non-null distinct values from the specified expression. Those less typically used functions do not appear in the list but can still be used in an expression. Count Returns a count of the non-null values from the specified expression. data regions. Conversion. CountRows Returns a count of rows within the specified scope. Aggregate. as defined by the data provider. Last Returns the last value from the specified expression. Inspection. CDbl() or CDec(). Financial. use conversion functions such as the following: CInt(). Avg Returns the average of all non-null values from the specified expression. The following table describes the aggregate functions that are supported by Reporting Services. where they are listed by category: Text. Program Flow. RowNumber Returns a running count of all rows in the specified scope. Max Returns the maximum value from all non-null values of the specified expression. Built-in functions include the Microsoft . Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . and groups. First Returns the first value from the specified expression.NET Framework common language runtime (CLR) classes and Visual Basic run-time library functions. All data that is used for an aggregate calculation must be the same data type. You can use aggregate functions in expressions for any report item. and Miscellaneous. properties. Math. • For expressions outside data regions. VarP Returns the population variance of all non-null values of the specified expression. or data region. dataset. Scope refers to a data table or business object. Scope is optional for all aggregate functions. StDevP Returns the population standard deviation of all non-null values of the specified expression. For expressions within data regions. Scope is required.Reporting in Microsoft Dynamics® NAV 2013 Function Description RunningValue Uses a specified function to return a running aggregate of the specified expression. • If a report contains more than one dataset. Information related to Scope includes the following: 3 . This defines the scope in which the aggregate function is performed. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Reporting Services provides the following additional aggregate functions that you can use within expressions. Var Returns the variance of all non-null values of the specified expression. the scope of the aggregate is the innermost data region or grouping to which the report item belongs. Function Description InScope Indicates whether the current instance of an item is within the specified scope. A valid scope is the name of a grouping. StDev Returns the standard deviation of all non-null values of the specified expression. Each aggregate function uses the Scope parameter. Sum Returns a sum of the values of the specified expression. Level Returns the current level of depth in a recursive hierarchy. Previous Returns the previous instance from the specified scope. Only groupings or data regions that directly or indirectly contain the expression can be used as a scope. If you are omitting the Scope parameter. • If a report contains only one dataset and Scope is omitted. the scope is set to the dataset.26 • Specifying a scope of Nothing sets the scope to the outermost data region to which the report item belongs. Import. He will implement this in the existing report. Click Open to import the object in the database. right-click the column header of the first row in the table. c. Demonstration: Using a Report Function in an Expression The management of Cronus International Ltd. In Visual Studio Report Designer. In the Report Dataset Designer click View. d. verify that the action is set to Create. Left. Select Tools. in the text box on the detail row enter the following expression: =RowNumber(Nothing) Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 .Module 3: Adding Code to a Report • The Nothing keyword cannot be specified for report items outside a data region. In the newly added column. Select File. k. h.27 . f.fob. j. i. choose to open the Import Worksheet window. Browse to the report R123456711. select report 123456711 Resource – List2 and then click Design. Click OK to start the import. e. Select Insert Column. In the Object Designer. In the dialog box. asked Mort to add row numbers to the report 123456711 Resource List2. l. and then select Layout. Mort knows this can be easily performed by using the RowNumber function. Demonstration Steps 1. g. Add a row number to report 123456711 Resource – List2: a. Object Designer to open the Object Designer. In the Action column. • The Scope parameter cannot be used in page headers or footers. b. as is described here. Save and close Visual Studio and then save and close the Report Dataset Designer. A child group and its siblings are contained by its parent group. a data region. Scope for aggregate functions The report processor evaluates each aggregate expression in a named scope or the default scope.8: REPORT WITH ROWNUMBER WINDOW Understanding scope The term scope can specify different concepts. Scope for report items in report processing When the report data and the report layout are combined at run time.Reporting in Microsoft Dynamics® NAV 2013 m. For example. each report item is processed. n. So.28 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Run the report. or a group. A named scope can be the name of a dataset. a toggle item for a group must be a text box in the same group scope or in any that contains a group scope. depending on the context. a group is contained by a data region. The result will resemble this: FIGURE 3. A Tablix data region is processed from the outside into more restrictive sets of data as the Tablix row groups and column groups are processed. 3 . The following list describes the different concepts. check the function reference to determine which scopes are valid. innermost groups to which the cell belongs.Module 3: Adding Code to a Report The default scope depends on the report item property that the report processor is evaluating. a Tablix data region provides visual elements that you can use to help determine a cell's available scopes. Nested data regions Specifies the data for the nested data region in the context of the cell to which it is added. You must specify the name of the dataset to use. For example. there is no default scope. and after the nested data region filter and sort expressions are applied. For the purposes of identifying scope containment. Data region Specifies data from the data region after data region filter and sort expressions are applied. every parent group contains its child groups. The default scope for a cell in a table without groups is the details group. for example. The following scopes list the containing order from outermost (greater) to innermost (reduced) and describe the data that they represent: Report dataset Specifies the report dataset linked to the data region or to a report item in the report body. the default scope for a Tablix cell in a data region with row and column groups is the innermost row group and column group to which the cell belongs. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . When a cell is selected.29 . Row and column groups Specifies the data after the group expressions and group filters are applied for the parent group and child groups. The data that is used for aggregation is from the report dataset after dataset filter expressions are applied. When you call a built-in function and specify a named scope. For example. for Sum."Dataset1"). For a text box on the design surface. On the design surface. Group filters are not used when calculating aggregates for data regions. group indicators show the active.Value. Group bars appear before and next to the Tablix data region to show which rows or columns belong to a group. =First(Fields!Sales. you can specify the default scope or a containing scope. Combine more than one field by using concatenation operators and Visual Basic constants. and affect how data is retrieved (filtering and sorting expressions). each on a separate line in the same text box: 3 . Many expressions in a report contain functions. apply logic. You must use the default scope or specify a scope that is higher in the containment order.30 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . These include expressions to change the appearance of data in a report. String Functions String functions can be used to manipulate string values in a report. • Change the format of strings. nor can you specify a sibling row group. You can format data. you cannot specify the name of the child group as a scope. you cannot specify a scope that is lower or at the same level in a containment order than the current scope. from a row in a row group that has a child group. change properties of report items.Reporting in Microsoft Dynamics® NAV 2013 Row and column groups for the nested data regions Specifies the data after the nested data region's group expressions and group filters are applied. You can use several functions to do the following tasks: • Concatenate fields and constants by using concatenation operators and Visual Basic constants. When a built-in function states that you must specify the current scope or a containing scope. For example. The following expression returns two fields. Expression Examples Expressions are frequently used in reports. • Return substrings. and access report metadata by using these functions: • String functions • Date and Time functions • Conversion functions • Decision functions • Report functions This lesson describes some expressions that can be used for common tasks in a report. • Format dates and numbers. RegularExpressions are useful for changing the format of existing strings.Value.Value. Len().Value. The following expression returns the part of the string to the right of a backslash (\) character from a report global named User: Returning a substring =Right(Globals!User.Value. The following expression displays values of the StartDate and EndDate fields in long date format: Format dates and numbers =Format(Fields!StartDate. "D") & " through " & Format(Fields!EndDate.RegularExpressions. and InStr() functions are useful for returning a substring. "\")) Change the Format of Strings The Regex functions from the .Module 3: Adding Code to a Report Concatenation =Fields!FirstName.Value Format dates and numbers in a string with the Format function. for example.Value.Regex. "(\d{3})[ .Text.31 .Value & vbCrLf & Fields!LastName.InStr(Globals!User.Text. "($1) $2-$3") Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 .Replace(Fields!Phone. formatting a telephone number. you should use the Format property of the text box to apply formatting instead of the Format function within the text box.]*(\d{3})[ -.NET Framework System. Return Substrings The Right(). The following expression uses the Replace function to change the format of a ten-digit telephone number in a field from "nnn-nnn-nnnn" to "(nnn) nnn-nnnn": Regular expression =System.Value) . for example. Len(Globals!User.]*(\d{4})". "D") If the text box contains only a date or number. trimming DOMAIN\username to just the user name. Now() returns a Date value containing the current date and time according to your system.Value) The DateAdd() function is useful for supplying a range of dates based on a single parameter.32 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Value) The Year() function displays the year for a particular date. Code Example =Year(Fields!OrderDate. The Month() function and other functions are also used to manipulate dates. Fields!StartDate. 6. 3 . You can use this to group dates together or to display the year as a label for a set of dates. The following expression provides a date that is six months after the date from a field named StartDate. Code example =DateAdd(DateInterval.Month. you can either select a predefined format or define a custom format by using several date and time functions.Reporting in Microsoft Dynamics® NAV 2013 Date and Time Functions Date functions are used to analyze and format a date in a report. or in a parameter to filter data based on the current date. Examples The Today function provides the current date. such as the following: • DatePart • Year • Month • MonthName • Day • Weekday • WeekdayName • Hour • Minute • Second You can also perform date calculations (by using functions such as DateDiff() and DateAdd()) and converting a string to a date by using CDate(). To format a date. This expression provides the year for a given group of sales order dates. This expression is used in a text box to display the date on the report. depending on the value of PercentCompleted. The following expression converts the constant 500 to type Decimal: Code Example =CDec(500) Program Flow Functions You can use decision functions to evaluate a logical or relational condition and return a specific value that is based on the result of the evaluation. The following expression can be positioned in the fill color of a text box to change the background color. IIF(Fields!PctComplete. CLng. CStr.False) You can use multiple IIF() functions (also known as "nested IIFs") to return one of three values. The Switch() function is useful when you have three or more conditions to test. "Red")) Values that are greater than or equal to 10 are displayed with a green background.True.Module 3: Adding Code to a Report Code example =Year(Fields!OrderDate. CBool. The following expression uses the IIF() function to return a Boolean value of True if the value of LineTotal exceeds 100. Otherwise it returns False: Code Example =IIF(IsNothing(Fields!LargePhoto. A different way to obtain the same functionality is to use the Switch() function. Examples are CInt.Value >= 1. CDec.Value).Value >= 10. and a value that is less than one is displayed with a red background.33 . "Green". Code example =IIF(Fields!PctComplete. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . values between one and nine are displayed with a blue background. "Blue". Conversion functions are used to convert the default data type for a field to the data type needed for calculations or to combine text. depending on the value in the text box. CShort. CDbl. CSng.Value) Conversion Functions You can use Visual Basic functions to convert a field from one data type to a different data type. depending on whether the expression is true or not. CDate. The IIF() function returns one of two values. Value) The following expression can be used to control the Hidden property of an image report item. Code example =IIF(Fields!PhoneNumber.Value. values between one and nine are displayed with a blue background.Fields!ImportantDate.Value = 1. In the following example.Value Is Nothing. a value equal to one is displayed with a yellow background."No Value". Fields!PctComplete.Reporting in Microsoft Dynamics® NAV 2013 The Switch() function returns the value associated with the first expression in a series that evaluates to true: Code example =Switch(Fields!PctComplete. otherwise the phone number value is returned. Fields!PctComplete. you will test the value of the PhoneNumber field."Red"."Blue") Test the Null Value In the following example. This expression can be used to control the Color property of a text box in a report item: Code example =IIF(DateDiff("d". This expression can be used to control the value of a text box in a report item.Value >= 1.) Values greater than or equal to 10 are displayed with a green background.Value <= 0.Fields!PhoneNumber. If the field is null (Nothing in Visual Basic). the image specified by the field [LargePhoto] is displayed only if the text value of the field is not null.False) 3 . Now())>7.Value >= 10. and a value that is zero or less is displayed with a red background.Value). "Green".34 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . "No Value" is returned. Code example =IIF(IsNothing(Fields!LargePhoto.True. "Yellow". The following line of code tests the value of the ImportantDate field and returns "Red" if it is more than a week old. "Blue". and "Blue" otherwise. Fields!PctComplete. "Red". Sum() The Sum() function can total the values in a group or data region. the following expression.35 . Additionally. To start the count within nested data regions. The following expression displays the sum of data in the Order group or data region: Code Example =IIF(RowNumber("table1") Mod 2 = 0. The scope that you specify for RowNumber() controls when renumbering begins. it displays the row number for each instance of the text box in which the expression appears. reporting functions are used to retrieve other data values.Module 3: Adding Code to a Report Report Functions Reporting functions are built-in functions for use in expressions to calculate aggregate data in datasets. use the name of the data region. use the name of the group. For example. This function can be useful to number rows in a table. when it is positioned in a group header. such as the first or last value on a report page. RowNumber() When the RowNumber() function is used in a text box in a data region. Started and Finished. data regions. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . This function can be useful in the header or footer of a group. if a dataset has a field that is named State with possible values Not Started. such as providing page breaks based on number of rows. "Transparent") You can also use the Sum() function for conditional aggregate calculations. and groups. Code example =RowNumber(Nothing) The following line of code is used to evaluate whether the record in a data region control named table1 is located on an odd or even row number. Two of the most important functions are the Sum() and the RowNumber() function. "LimeGreen". The Nothing keyword indicates that the function starts the count at the first row in the outermost data region. To start the count in a group. calculates the aggregate sum for only the value Finished. It can also be useful for more complex tasks. 36 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .ExecutionTime. provides the page number and total pages in the report: Code example =Globals. positioned in a text box in the footer of a report. and then add a group expression to group by a specified number of rows. display information about the report.Reporting in Microsoft Dynamics® NAV 2013 Code example =Iif(RowNumber("table1") Mod 2. dated " & Format(Globals. add a page break to the group. It can be positioned in a text box in the report footer or in the body of the report. Page Headers and Footers When you design a report.TotalPages Page Breaks In some reports. on groups or report items. create a group that contains the groups or detail records that you want. or in addition to.NET Framework formatting string for short date: Code Example =Globals. you might want to display the name of the report and page number in the report footer. The following expression uses the Ceiling() function. To do this. When a page break is defined for the group. The following expression provides the name of the report and the time that it is run. The time is formatted with the . For example. Appearance of Report Data You can use expressions to manipulate how data appears on a report. this expression results in a page break every 25 rows. or affect how page breaks are inserted in the report. "d") The following expression. When it is positioned in the group expression.ReportName & ". you might want to position a page break at the end of a specified number of rows instead of. you can display the values of two fields in a single text box. "PaleGreen".PageNumber & " of " & Globals. it assigns a number to each set of 25 rows. "White") It can be used to work with alternating background colors. 3 . The following expression. as is shown in the following expression: Code example =CInt(Ceiling(RowNumber(Nothing)/Fields!RowsPerPage.Value)) On the Group Header. They can also be used to change how properties are applied to report items. A similar technique is also used in the Sales Invoice report. or use dynamic URLs. create a variable RowsPerPage (the number can be added as a variable to the request options page) and then base the group expression on the variable. depending on the value of another field. alternates the background color of each row between pale green and white: Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . use the Fields!FieldName syntax. in this case the Profit field: Code Example =Iif(Fields!Profit. This is explained in the next lesson. Properties Expressions are not only used to display data in text boxes. or use the Visual Basic object Variable Me. when it is used in the BackgroundColor property of a report item in a data region. "Black") To refer to the value of the current field. "Red". change its visibility. changes the color of the text. when it is used in the Color property of a text box. You can change style information for a report item.37 .Module 3: Adding Code to a Report Code example =CInt(Ceiling(RowNumber(Nothing)/25)) For the user to be able to set a value for the number of rows for each page. • Formatting • Visibility • URLs Formatting The following expression.Value < 0. to have multiple copies of the report printed. remember to check the Page Break at End option. "PaleGreen". when it is used the first time for visibility of detail rows in a group. This expression is set as a Hyperlink action (select Properties. when you work with the items for the first time. False. True) The following expression. This expression depends on a variable named IncludeURLs that lets a user decide whether to include active URLs in a report. replace the Nothing value by the name of the data region control that corresponds to the scope.Reporting in Microsoft Dynamics® NAV 2013 Code example =Iif(RowNumber(Nothing) Mod 2.38 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . you can hide detail rows based on the value in an expression. In a data region such as a table.Value The following expression conditionally controls whether to add a URL in a text box. 3 .Value>.true. Therefore. "White") If you use an expression for a specified scope (for example the table called Employees in the report). it shows the detail rows for all sales exceeding 90 percent in the PctQuota field: Code example =Iif(Fields!PctQuota. The following expression. Visibility You can show and hide items in a report by using the visibility properties for the report item. generates a customized URL that specifies the dataset field EmployeeID as a URL parameter. when it is used as an action on a text box.9. and then select the Navigation tab) on a text box. shows the table only if it has more than 12 rows: Code example =IIF(CountRows()>12.false) URLs You can customize URLs (Uniform Resource Locator) by using report data and also conditionally control whether URLs are added as an action for a text box. The following expression. Code example ="http://adventure-works/MyInfo?ID=" & Fields!EmployeeID. it might be necessary to indicate the dataset for the aggregate function. when set in the Hidden property of a table. you can create your own custom code (functions and variables) to enrich the report functionalities. (NaN means Not a Number. instead. Num2 as double) AS object IF ISNOTHING(Num2) Or Num2 = 0 Then Divide ="n/a" ELSEIF Num1 = 0 THEN Divide = 0 ELSE Divide = Num1 / Num2 END IF End Function Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . it is a value or symbol that is generated as the result of an operation on invalid input terms. you have to be careful with NULL and 0 (zero) values because. a user-friendly value.com/productcatalog". NaN being returned in the reports. select Report. use it to add presentation related code. As an example. if there is an accidental error.Value. especially in floating-point calculations. To add code to a report in Visual Studio Report Designer.Module 3: Adding Code to a Report Code example =IIF(Parameters!IncludeURLs."http://adventureworks.Nothing) Custom Code You can use custom code in a report. It is recommended not to add custom code that executes business logic. and then select Report Properties. one of the most common calculations in reports is division. when you divide a variable by NULL or by 0. The sample division function can resemble this: Code Example Public Shared Function Divide(Num1 as double. you can create a function that checks the terms and returns the numeric result or. A typical example is calculating the square root of a negative number. To avoid this. On the Code tab.39 . When you divide numeric variables. Custom code is either embedded in a report or stored in a custom assembly which is used in the report. it results in a runtime error and or. Divide function. "Bicycle") Return strBuilder.Contains("Bike") Then strBuilder. The example assumes that the following function is embedded on the report's Code tab.StringBuilder(s) If s.Replace("Bike". 0) Instead of calling the Code. Code example Public Function FixSpelling(ByVal s As String) As String Dim strBuilder As New System.Reporting in Microsoft Dynamics® NAV 2013 You can then call this function from an expression such as this: =Code.Value) The following example calls an embedded code method called ToUSD().40 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Text.FixSpelling(Fields!SubCategory. A similar example calls an embedded method called FixSpelling(). use an expression with an IIf() statement in each text box where you want to calculate the division. 3 . set the Value property of the SubCategory field to: =Code.Divide(1. Adding custom code increases the maintainability of your report code. This converts the StandardCost field value to a dollar value. This substitutes "Bicycle" for all occurrences of the text "Bike" in the SubCategory field.ToString() Else : Return s End If End Function To have the values replaced at run time for each record in the report. Value) Custom Variables The following example shows how to define some custom constants and variables.456 Although custom constants and variables do not appear in the Expression Editor Constants view (which only displays built-in constants).ToUSD(Fields!StandardCost. The following section will highlight those functions. These are treated as Variants. you can add references to them from any expression. some custom functions are made available in the Code tab of the report properties.41 .MyDoubleVersion When you create a new report in Microsoft Dynamics NAV 2013.MyVersion =Code. Use this function when it is required not to show 0 (zero) values. Code example Public Const MyNote ="Authored by John Doe" Public Const NCopies As Int32 = 2 Public Dim MyVersion As String ="123. Code example =Code.Module 3: Adding Code to a Report Code example =Code.456" Public Dim MyDoubleVersion As Double = 123.MyNote =Code. BlankZero transforms a 0 (zero) value into a blank. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . as is shown in the following examples.NCopies =Code. it will not return a value. it will not return a value.42 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Reporting in Microsoft Dynamics® NAV 2013 Code example Public Function BlankZero(ByVal Value As Decimal) if Value = 0 then Return "" end if Return Value End Function The BlankPos function will only return negative or zero values. Use this function if it is required only to show negative or zero values. Code example Public Function BlankZeroAndPos(ByVal Value As Decimal) if Value >= 0 then Return "" end if Return Value End Function 3 . Use this function if it is required only to show negative values. When a positive number (or decimal) is passed into this function. When a positive number (or decimal) is passed into this function. Code Example Public Function BlankPos(ByVal Value As Decimal) if Value > 0 then Return "" end if Return Value End Function The BlankZeroAndPos function will only return negative values. 43 . it will not return a value. Use this function if it is required only to show positive values.Module 3: Adding Code to a Report The BlankNeg function will only return positive or zero values. Use this function if it is required only to show positive or zero values. it will not return a value. When a negative number (or decimal) is passed into this function. Code example Public Function BlankNeg(ByVal Value As Decimal) if Value < 0 then Return "" end if Return Value End Function The BlankNegAndZero function will only return positive values. Code Example Public Function BlankNegAndZero(ByVal Value As Decimal) if Value <= 0 then Return "" end if Return Value End Function Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . When a negative number (or decimal) is passed into this function. change the expression to the following. click Report. b. right-click the text box that has the number that you want to round. select Layout. Fields!SalesLCY_Customer. call the ROUND function. you can use the ROUND function to round a double-precision floating-point value to the nearest integer. 12. In this example.Reporting in Microsoft Dynamics® NAV 2013 Demonstration: Specify a Rounding Precision In Visual Studio Report Designer. In the View menu. and it depends on the degree of precision that you want. In Object Designer. Factor is a factor of 10. on the Tools menu. by the factor. if you want to round the number 12. Demonstration Steps 1. Next. The factor that you select depends on the degree of precision that you want. d. to the nearest hundredth. h. e.3456 by 100 to receive 1234. 100. Save and compile the report.35. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . you must multiply the number by a factor of 10. you would multiply 12. click Object Designer.3456 to the nearest hundredth. call the ROUND function on 1234. For example. to receive 12. a. this function does not have options for changing the precision to which you want to round.3456. Select the OK button to close the Expression window.56. This result is the same as rounding the original number. and then divide the rounded number by the same factor of 10.44 f. only to the nearest integer. Finally. To specify precision when you use the ROUND function. However. This results in the number 1235. In the development environment. Use an expression to specify rounding precision. for example textbox SalesLCY_Customer (second row. In Visual Studio. g.56.rdlc file. For example. in the Report. c. fifth column) and then click Expression. divide the rounded number. select a report that contains a number that you want to round with precision greater than the nearest integer. 1235. The ROUND function rounds to the nearest integer.Value*10)/10 3 . In the Expression window.Value is the numeric value that you want to round. for example report 123456771 Customer Top 10 List2 and then click Design. you cannot round to the nearest tenth or nearest hundredth of a number. =ROUND(Fields!SalesLCY_Customer. a. 3. c.45 . b. and then select a report that contains a number that you want to round with precision greater than the nearest integer.Module 3: Adding Code to a Report 2. in the Report. In Visual Studio. On the View menu. click Layout. In the development environment. In the Report Properties window. Add the following lines of code to the Code tab in the Custom Code textbox. and then select Design. select Report Properties. f. Amount2 as Decimal) as Decimal if Amount2 <> 0 then Pct = Amount1 / Amount2 * 100 else Pct = 0 end if REM Rounding precision = 0. Add code to specify rounding precision. Click OK to close the Report Properties window b. In Object Designer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . The following code example shows a function that calls the ROUND function and uses the previous procedure to specify precision. d. click Object Designer. if the function is not already present. on the Tools menu.rdlc file. Code Example Shared Pct as Decimal Public Function CalcPct(Amount1 as Decimal. Save and compile the report. click Report. e. on the Report menu.1 Return ROUND(10*Pct)/10 End Function a. select the Code tab. The Integer table is used for the logical loops that are run through during report execution. The report also uses a virtual table: Integer. some supporting variables are used to access information from tables that do not fit into the data model. However. This lesson provides an overview of the Sales Invoice report. the Sales Invoice report (report 206) is used to print sales invoices. Shipment Method and Company Information. The Company Information table is used to retrieve information about the company that is preparing the invoice. because the Sales Invoice report is built similar to other reports in Microsoft Dynamics NAV 2013. Supplemental tables.Reporting in Microsoft Dynamics® NAV 2013 Anatomy of the Sales Invoice Report In Microsoft Dynamics NAV 2013. are used to expand the code fields that are used in the invoice tables.46 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . such as Payment Terms. The Data Model The logical design for the Sales Invoice report includes the following data model: • Sales Invoice Header o Integer (CopyLoop)  Integer (PageLoop)  Integer (DimensionLoop1)  Sales Invoice Line o Integer (Sales Shipment Buffer) o Integer (DimensionLoop2) o Integer (AsmLoop)  Integer (VATCounter)  Integer (VATCounterLCY)  Integer (Total)  Integer (Total2) There are two primary tables that are used to create a sales invoice—the Sales Invoice Header and the Sales Invoice Line. to more descriptive text. you must understand how it is designed. the Sales Invoice report can be difficult to understand. In this report. 3 . and it will also focus on the RDLC report layout. Technically. IF NoOfLoops <= 0 THEN NoOfLoops := 1. To make the variable available in the dataset. a piece of code is added that initializes a new Integer variable.1. which is subordinated to the CopyLoop cycle. all pages are printed in the PageLoop cycle. If two copies of the report will be printed. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . depending on the number of copies required. Although the CopyLoop is not the top-level data item in the report. OutputNo := 1.OnPreDataItem The CopyLoop data item is executed for each Sales Invoice Header. OutputNo. (The Sales Invoice Header data item is mainly only used for filtering and data retrieval purposes. To have the pages of the invoice grouped by invoice header. If multiple reports will be printed. all pages of the invoice will be printed before the invoice is printed again. CopyText := ''. The variable is used to control the number of copies of a report and it is also used to group the pages and copies of the report. a workaround must be used to be able to print it multiple times. not much new code is added. In the OnPreDataItem trigger of the CopyLoop data item.Module 3: Adding Code to a Report The Triggers If you compare the report earlier versions and view the triggers of the data items in the report. it is added as a column in the report dataset designer in the integer (PageLoop) data item."Invoice Copies" + 1. CopyLoop . all copies of the first invoice will be printed before the next invoice is printed.) If a sales invoice has more than one page. The function of this data item is to have multiple copies of the report printed in one report run. it controls the printing of the whole report. Code Example NoOfLoops := ABS(NoOfCopies) + Cust. An explanation of the code changes for each data item follows.47 . Because the Reportviewer client supports only one body section. All other data items depend on this data item and are repeated for each copy loop. SETRANGE(Number. a new integer variable OutputNo is introduced.NoOfLoops). TotalAmount := 0. and so on.OnAfterGetRecord In the OnAfterGetRecord trigger. you can define how many additional copies are required for every customer.000 to 1. TotalInvoiceDiscountAmount := 0.000. By applying a filter to the Integer virtual table. two segments of code are added. you can easily access a subset or range of numbers that can be used to control looping in reports. TotalSubTotal := 0. OutputNo will be two. OutputNo += 1. Code example IF Number > 1 THEN BEGIN CopyText := Text003. For this a variable is used: CopyText.000. 3 . For the first copy of the report. END. CurrReport. The integer data item is then filtered from one to the required number of copies. The OutputNo value is used to group the data in the report.000.48 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . CopyLoop . TotalAmountVAT := 0. there is a risk of creating an unintended large loop. for the second copy. A text will be added on all copies of the invoice. The range of the integer table is -1. The first piece of code is used to increment the OutputNo value for each copy of the report. If you omit this.PAGENO := 1. In this trigger that value is fetched for the customer and is added to the NoOfCopies variable.000.Reporting in Microsoft Dynamics® NAV 2013 On the Customer Card. OutputNo will equal one. TotalPaymentDiscountOnVAT := 0. Best Practice: When you work with integer data items it is important to apply a filter. TotalAmountInclVAT := 0.000. when you print the document. " := ''. VATAmountLine.OnAfterGetRecord As previously mentioned. VATAmountLine. VATAmountLine. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 .Module 3: Adding Code to a Report The second segment of code is used to reset several variables to zero for each copy of the report.49 ."VAT Base" := Amount. the following piece of code is added: Code Example PostedShipmentDate := 0D. VATAmountLine. VATAmountLine. The variables are used to display the different subtotals in the RDLC report layout."VAT Calculation Type" := "VAT Calculation Type". VATAmountLine. Sales Invoice Line . IF (Type = Type::"G/L Account") AND (NOT ShowInternalInfo) THEN "No. the subtotals are calculated and stored in variables for the RDLC report layout."VAT %" := "VAT %". To calculate the totals."Tax Group Code" := "Tax Group Code".INIT."Line Amount" := "Line Amount". IF Quantity <> 0 THEN PostedShipmentDate := FindPostedShipmentDate. VATAmountLine."VAT Identifier" := "VAT Identifier". VATAmountLine."Amount Including VAT" := "Amount Including VAT". "Invoice Discount Amount" := "Inv. TotalAmount += Amount. VATAmountLine." THEN VATAmountLine. Discount Amount" "Amount Including VAT"). Discount Amount".InsertLine. The totals are added as columns in the report dataset designer Sales Invoice Line data item and converted to dataset fields at run time.Amount."Inv. 3 ."Inv. TotalAmountInclVAT += "Amount Including VAT". Base Amount" := "Line Amount". TotalSubTotal += "Line Amount". Discount Amount". TotalInvoiceDiscountAmount -= "Inv. VATAmountLine.Reporting in Microsoft Dynamics® NAV 2013 IF "Allow Invoice Disc. Disc.50 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . TotalAmountVAT += "Amount Including VAT" . TotalPaymentDiscountOnVAT += -("Line Amount" . There are many controls and tables both in the header and in the body.Module 3: Adding Code to a Report The Layout View the layout of the report.9: RDLC REPORT LAYOUT OF THE SALES INVOICE Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 .51 . FIGURE 3. fields from the Salesperson/Purchaser table. The fourth column contains all kinds of information related to the Sales Invoice Header: fields from the Sales Invoice Header (such as Due Date). The Body In the upper-left corner of the Body section two hidden tables are visible. The right table has three columns and contains the logo from the Company Information table. The first column contains all fields for the customer's address. The left table contains four columns.52 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . 3 .ToBase64String() function. The third column contains much information coming from the Company Information table. Each column contains specific information that is available through variables. by using the Convert.Reporting in Microsoft Dynamics® NAV 2013 Some controls have red text and are invisible controls. The picture is converted to text for it to be stored in a text box. The second column includes information about the company address. The Hidden property in the Visibility property collection is set to True. and other elements. Value) + Chr(177) + First(Fields!DocDate_SalesInvHdr.Value + Chr(177)+ Fields!CompanyInfoVATRegNo.Value) + Chr(177) + Fields!SalesPurchPersonName.Value + Chr(177) + Cstr(Fields!PricesInclVATYesNo_SalesInvHdr.Value + Chr(177) + Fields!HdrOrderNo_SalesInvHdr.Value+Chr(177)+ Fields!CustAddr5.53 .Value+Chr(177)+ Fields!CustAddr6.Value + Chr(177) + Fields!CompanyAddr1.Value + Chr(177) + Fields!CompanyAddr2.Value Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 .Module 3: Adding Code to a Report The following table shows the names and values of the four text boxes.Value+Chr(177)+ Fields!BilltoCustNo_SalesInvHdr.Value+Chr(177)+ Fields!CustAddr7. Name CustAddr Value Expression =Fields!CustAddr1.Value + Chr(177) + Fields!DueDate_SalesInvHdr.Value + Chr(177) + Fields!PostingDate_SalesInvHdr.Value + Chr(177)+ Fields!CompanyInfoBankName.Value+Chr(177) + Fields!CustAddr2.Value + Chr(177) + Fields!CompanyInfoPhoneNo.Value + Chr(177)+ Fields!CompanyInfoGiroNo.Value+ Chr(177) + Fields!DocumentCaptionCopyText.Value + Chr(177) + Fields!CompanyAddr4.Value + Chr(177) + Fields!No_SalesInvHdr.Value + Chr(177) + Fields!YourReference_SalesInvHdr.Value + Chr(177)+ Fields!OrderNoText.Value + Chr(177) + Fields!CompanyAddr3.Value+Chr(177)+ Fields!ShipmentMethodDesc.Value + Chr(177) + Fields!VATRegNo_SalesInvHdr.Value+Chr(177)+ Fields!CustAddr3.Value + Chr(177) + Fields!CompanyAddr5.Value+Chr(177)+ Fields!CustAddr8.Value + Chr(177)+ Fields!CompanyInfoBankAccNo.Value + Chr(177)+ Fields!HomePage.Value+Chr(177)+ Fields!PaymentTermsDesc.Value+Chr(177)+ Fields!CustAddr4.Value + Chr(177) + Fields!CompanyAddr6.Value+ Chr(177)+ Fields!EMail. The HeaderDim table contains information regarding the dimensions of the sales invoice header. all dimensions for the posted sales invoice header will be run through and stored in a text variable. The first header row in the table will be printed the first time the DimensionLoop cycle is run through. Using a table detail row can affect report execution time. When the GetData() function is called. The table footer row displays the totals for the VAT Amount Specifications. (see property RepeatOnNewPage) The Table_VAT table contains all value-added tax (VAT) related specifications from the VATCounter data item. The first two (header) rows of the table contain captions. The two group header rows display the details of the Sales Invoice Line. 3 . The first header row contains the field captions. The first three (header) rows of the table contain captions and information about the exchange rates of the amounts. several tables are visible that are used to display the various blocks of information that must be included in the report. (Parameters!) The table contains two groups. data in the group is split by using the Split function that has Chr(177) as a separator. Code Example =Iif(Fields!Type_SalesInvLine. This kind of hidden information is included in a table header row and not in a table detail row (because it is only needed one time). The group footer rows are used to show the different subtotals. Again visibility options are defined to show or hide the rows when necessary. The second header row will be printed in all other loops. In the DimensionLoop of the report. The detail row shows all details for the VATCounter data item.Reporting in Microsoft Dynamics® NAV 2013 In each expression. Chr(177) is used to separate the different data parts in each group. false.Value = " ". The detail row shows all details for the VATCounter data item. false) The first detail rows contain details regarding the posted shipments. The TableLines table contains all details of the Sales Invoice Line table.Value = " ". The table footer row displays the totals for the VAT Amount Specifications in local currency. The Hidden property for these rows is set in a way that the first row header is printed for sales invoice lines where the Type field is <blank> and the second header is printed for the other sales invoice lines. true) =Iif(Fields!Type_SalesInvLine. The Table_VATLCY table contains all VAT related specifications from the VATCounterLCY data item. Later in the Body section. true. The table is only printed when the Show Internal Information option is checked in the request options page.54 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . The table properties are set to repeat the table header row on each page. the dimensions and posted assembly line information for the sales invoice line. The table is not shown if the Sell To Customer is the same as the Bill To Customer.Value)= First(Fields!BilltoCustNo_SalesInvHdr. all controls that are positioned inside a list control will be deleted too. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 .Module 3: Adding Code to a Report Finally. You can arrange report items to create a form with text boxes. Code Example =(First(Fields!SelltoCustNo_SalesInvHdr. and other data regions that are positioned anywhere within the list.55 . images. This table is placed inside a second List (list2). It contains three header rows (with a table caption and some customer information) and detail rows (including the Ship-To Address information). When you delete a list control. A list is a data region that presents data arranged in a freeform manner. The list is considered a large form and it will be printed as such. the TableShipToAddress table contains shipping information for the sales invoice header.Value)) The List Control All tables in the body are positioned inside a list control. 3 . You can use this value to group upon in the List control and to display the content of the list as many times as copies are required.56 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Reporting in Microsoft Dynamics® NAV 2013 You can also use the List control to group its content.10: LIST GROUP PROPERTIES SCREEN SHOT The code in the CopyLoop – OnAfterGetRecord trigger makes sure the OutputNo variable is incremented for every required copy. In this report the List is grouped first on [Sales_Invoice_Header_No_] and then on [OutputNo] as is shown in the group properties: FIGURE 3. when you run the Sales Invoice report. and in the request options form request 2 copies like in the following screenshot: FIGURE 3.Module 3: Adding Code to a Report As an example.11: NUMBER OF COPIES 2 WINDOW then in the report you can consult the generated dataset and notice that the dataset is duplicated 2 times as you can see in the following screenshot: Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 .57 . 3 . The Header At the top of the Header section. there is a hidden textbox (textbox71).12: NUMBER OF COPIES DATASET WINDOW So instead of a dataset that contains 4 rows it now contains 12 rows (1 original and 2 copies). The report also contains a header.58 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . The second parameter. unless specified otherwise in their properties. The first parameter. as we will explain in the next lesson. is the data value that is stored in the custom variable.Reporting in Microsoft Dynamics® NAV 2013 FIGURE 3.Value. is an integer that refers to the custom data variable that is used.SetData(ReportItems!CustAddr. To do this. A header (and footer) will be shown above (below) the body.1) The SetData() function has two parameters. the text boxes use the custom functions SetData() that is defined in the report. Group. The purpose of this control is to retrieve information that is stored (hidden) in the Body and to load it into custom variable. NewData. Code Example =Code. In this case.Group as integer) If Group = 1 and NewData > "" Then Data1 = NewData End If If Group = 2 and NewData > "" Then Data2 = NewData End If If Group = 3 and NewData > "" Then Data3 = NewData End If If Group = 4 and NewData > "" Then Data4 = NewData End If End Function The custom data variable is defined as shared variables of the type Object. and so on). From evaluating the expression that is set in the Value property of the text boxes. boolean. the data variables can be considered as arrays. string. Code Example Shared Data1 as Object An object is a more complex data type. As a first parameter. it can contain more complex data values.Module 3: Adding Code to a Report Code Example Public Function SetData(NewData as Object.59 . Shared means that they are available throughout the whole report. the data is retrieved from the hidden text boxes in the body and loaded into the custom variables. Unlike simple data types (such as integer. When the report is run and the header is rendered. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . such as data that can be broken down into smaller pieces. it starts with the text boxes at the top. This means that they contain multiple values. the function takes an element from the ReportItems collection. The string array is then passed as a second parameter to the Choose() function. The Split() function takes a string argument. the three image controls are rendered. and returns a string array. There are four groups: one for the customer address.60 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . is an integer value that refers to the element in the custom data variable.Reporting in Microsoft Dynamics® NAV 2013 Note: The ReportItems built-in collection is the set of text boxes from report items such as rows of a data region or text boxes on the report design surface. The second parameter. or report body. which has two parameters. the data is extracted from the variable using the Choose() and Split() functions. This collection is determined at run time by the report processor and the report renderer. Num. The first parameter. For example: 3 . refers to the data variable that is used. one for the shipping address. Group. The current scope changes as the report processor successively combines report data and the report item layout elements as the user views pages of a report. It has two parameters: the string to split (CStr(Data1)) and the space delimiter (Chr(177)). In the GetData() function. determines which element will be retrieved from the string array. After the hidden text boxes. The Choose() function selects and returns a value from a list of arguments. the other text boxes in the page header will be rendered. divides the string into elements by using the space character as the delimiter. Each of these textboxes is using the GetData() function. The Value property of the Image controls is set to: =Convert. You can use the ReportItems built-in collection to produce dictionary-style page headers that show the first and last items on each page. Now. one for the company information and one for the sales invoice header. The CStr() function is used to convert the custom variable to string. page footer.Value) where x represents an integer between 1 and 3 (both included)). Num.ToBase64String(Fields!CompanyInfoXPicture. The ReportItems collection includes text boxes that are in the current scope of a page header. The first parameter. This also applies to tables that span multiple pages. hidden fields needed to be included in the body of the report to successfully create the client report definition (RDCL) report layout. and one footer in a report.1) will return element 1 in the custom variable Data2. credit memos) that include multiple tables and require header information on each page. However. check the Repeat report item that has data region on every page and then specify the data region control that can span multiple pages.GetData(22. the hidden fields are added to the table in the body of the RDLC report layout. make sure that you do the following: • Create hidden text boxes in one table to obtain the data. This alternative is to include the information in a hidden text box in the body section (outside the data region control) and make the text box move with the data region control. • Create a function to save the data. • Create a function to retrieve the data. This corresponds to the Company Name (the first element in the CompanyAddr array). the header information only displays on the page that has the first table. Instead. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . select the text box properties. • There can be only one header. For reports such as document reports (invoices. You will call this function from one or more displayed text boxes in the header section. the header information will not display on the pages that display the the next tables.61 .Module 3: Adding Code to a Report Code Example =Code. it must be included as a hidden column in the data regions control that spans multiple pages. To pass information from one page to the next. the Body will be rendered. After the header is rendered. You will call this function from one or more hidden fields in the header section. To do this. However. there is an alternative solution. Typically. Print Header Information on Multiple Pages In the earlier version of Microsoft Dynamics NAV. if the report includes more than one table. one body. Remember that headers and footers in the client report definition (RDLC) report layouts have the following limitations: • Expressions in a header or footer can refer to only one report item. In the development environment. and then select =Fields!OutputNo. 2.Value from the drop-down list. and then select =Fields!OutputNo. this module described the code that is added to the data item trigger in the report that is required to initialize and increment the copy number.Reporting in Microsoft Dynamics® NAV 2013 The Number of Copies Option Frequently. 1. Also mentioned earlier is that the OutputNo must be added to the dataset of the report. follow these steps. In Microsoft Visual Studio Report Designer. 3. 4. Reset Page Numbers On some reports. and then specify a page break at the end of the group. In the Page Break tab. Click OK to close the Group Properties window. You must add code to set and update the copy number. displays sales invoices that are grouped by sales invoice number. Sales Invoice. follow these steps. click Layout.62 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Value from the drop-down list. report 206. For example. check the Between each instance of a group option. 2. 3 . To reset the page number to one for each group of data. you might want to group sets of data together and reset the page number after each group. To specify the page break for the report. In the Group Properties window. In the Group window. 1. for document type reports the request page displays an option for the number of copies to print. in the report. 5. select the next blank line to add a grouping. 3. Click selectGroup Properties. Select a blank line. in the standard application.rdlc file. right-click the row to group on. click the Sorting tab. a copy is the same as a new document that must start on a new page. and then click Edit Group. 4. In a client report definition (RDLC) report layout. Select the List control and select Row Groups. To Add Code to the Report for the Number of Copies Previously. on the General tab. on the View menu. group the data based on the copy number. To group data based on the copy number. you must modify code on the client report definition (RDLC) report layout. under Group on. In the development environment. 5. 6. select the Code tab. select a report to modify. on the Report menu. Add the following code in the Custom code text box: Code Example REM Reset Page Number: Shared offset As Integer Shared newPage As Object Shared currentgroup1 As Object Shared currentgroup2 As Object Shared currentgroup3 As Object Public Function GetGroupPageNumber(ByVal NewPage As Boolean. In Object Designer. ByVal pagenumber As Integer) As Object If NewPage Then offset = pagenumber . In Microsoft Visual Studio. ByVal group3 As Object) As Boolean newPage = False If Not (group1 = currentgroup1) Then newPage = True currentgroup1 = group1 Else If Not (group2 = currentgroup2) Then newPage = True currentgroup2 = group2 Else If Not (group3 = currentgroup3) Then newPage = True currentgroup3 = group3 End If End If End If Return newPage End Function Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . 1. click Layout. On the View menu.offset End Function Public Function IsNewPage(ByVal group1 As Object. 3.rdlc file. select Report Properties.1 End If Return pagenumber . 2.63 . click Report. in the Report. 4.Module 3: Adding Code to a Report To reset page numbers. click Object Designer. In the Report Properties window. follow these steps. ByVal group2 As Object. and then click Design. Value.Value. enter the following expression: =Code. In the Expression window.Globals!P ageNumber) 9.Reporting in Microsoft Dynamics® NAV 2013 7.IsNewPage(Fields!<grouping field1>[. In Visual Studio.<grouping field2>. on the General tab.GetGroupPageNumber(ReportItems!NewPage. you can modify the code in the IsNewPage function. and then select Properties. In the Properties window.64 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . create a new text box called NewPage. =Code. 11. if you are grouping by document type. 3 . then grouping field1 is Document_Type. right-click the text box in the header that displays the page number. enter the following in the Value field. you can either modify the code in the IsNewPage function or use a static value for one or more of the function parameters. in the Report. and then select Expression. 8.rdlc file.<grouping field3>]) For example. Right-click the NewPage text box that you created in step 8. 10. In the Body of the layout. To use more than three groupings. To use less than three groupings. You must add conditional formatting to make the report more user-friendly: • Table headers must be printed with a LightGrey background. The result must resemble this: In Lab 3. Now it is time to fine-tune the report.2. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 .65 . you will use expressions to add other functionality. • The Picture column must have a caption. • Negative inventory values must be displayed in bold and in red. • Rows must be printed with alternating colors.1: Adding Conditional Formatting to a Report Part I Scenario The RDLC report layout of the Item Catalog is already designed. • The Image control must be hidden automatically when an item has no picture.Module 3: Adding Code to a Report Lab 3. "PaleGreen". c. Unit Price. "Transparent") d.. You will use expressions to change visibility options and formatting. set the BackgroundColor property to LightGrey. b. Change the BackgroundColor of the captions. in the BackgroundColor property. c.66 Change the BackgroundColor of the details. In the header row of the table control. In the Expression window. select <Expression. Base Unit of Measure. Change the BackgroundColor of the captions. select the text boxes containing the No. you will continue designing the Item Catalog. Detailed Steps 1. Base Unit of Measure. Unit Price and Inventory fields. Change the BackgroundColor of the details. enter the following expression: =Iif(RowNumber(Nothing) Mod 2 = 0. Task 2: Change the Background Colors for the Detail Row High Level Steps 1. Inventory and Picture field captions. Exercise 1: Step by Step Task 1: Change the Background Color for the Header Row High Level Steps 1. a. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . b. Open report 123456724 in Visual Studio Report Designer. Detailed Steps 1.Reporting in Microsoft Dynamics® NAV 2013 Objectives In this lab.>. a. In the Properties window. 3 . select the text boxes containing the No.. Description.. Description. On the detail row of the table control. Click OK to close the Expression window. In the Properties window. f. c. "Bold". In the Properties window.Module 3: Adding Code to a Report Task 3: Change the Color of Negative Inventory Values to Red High Level Steps 1.. On the detail row.Value). Clear the ToggleItem property. a. Change the Visibility option for the Picture field.true. a. Click OK to close the Expression window. b. in the Color property.. Click OK to close the Expression window.. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . Detailed Steps 1. In the Expression window. Task 4: Change the Visibility Option for the Picture Field High Level Steps 1. expand the Font property collection. Change the Visibility option for the Picture field. select the text box containing the Inventory field.Value < 0. expand the Visibility property collection. c. In the Expression window. e. b. g. In the Expression window. Detailed Steps 1. "Normal") h.. In the Properties window. enter the following expression: =Iif(Me. enter the following expression: =Iif(Fields!Inventory_Item. select the Image control. e..Value < 0. "Red". In the Hidden property. enter the following expression: =Iif(IsNothing(Fields!Picture_Item. select <Expression. d.. In the Properties window. Change the color of negative inventory values to red.>. In the FontWeight property. select <Expression. select <Expression. "Black") d.false) f.>. Change the color of negative inventory values to red.>. On the detail row.67 . Click OK to close the Expression window. Run the report. Exit Visual Studio. Run the report from the File. d. Click OK to close the Tablix Properties window. Save and import the RDLC changes. b. c. a.68 Run the report.Reporting in Microsoft Dynamics® NAV 2013 Task 5: Repeat the Column Captions on Each Page High Level Steps 1. Detailed Steps 1. Detailed Steps 1. Repeat the Column Captions on each page. On the General tab. Select Tablix Properties. 3 . Save and compile the report in the Report Designer. The Tablix Properties window will appear. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Repeat the Column Captions on each page. a. b. c. Task 6: Run the Report High Level Steps 1. Run menu. check the Repeat header rows on each page option. 69 .Module 3: Adding Code to a Report Lab 3.2: Adding Conditional Formatting to a Report – Part II Scenario The Item Catalog report is used by CRONUS International Ltd. Then. a copy of the report that requires less detailed inventory information is sometimes provided to customers.14: ITEM CATALOG WITH IMAGES Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . you must change the report so that the user has the option to print the inventory as a numeric value or as an icon that indicates the inventory status: • Inventory > 0: show a green check mark • Inventory = 0: show a blue question mark • Inventory < 0: display a red cross The result will resemble this: FIGURE 3. detailed inventory information and pictures are included. To support both requests with the same report. Therefore. salespeople during the daily order process. Change the Report Dataset Designer. b. c.70 Change the Report Dataset Designer. enter GraphicalInventory in the Name column. g. Detailed Steps 1. d. a. Add a Boolean Variable to the development environment. d. you will introduce a Request Options page and work with multiple headers and detail rows. Close the C/AL Globals window. b. Select Boolean in the DataType column. Type GraphicalInventory as the Name. Open the report in the Object Designer. Click View. c. Save and compile the report. Open report 123456732 in the Object Designer. f. 3 . Task 2: Change the Report Dataset Designer High Level Steps 1.Reporting in Microsoft Dynamics® NAV 2013 Objectives In this lab. Exercise 1: Step by Step Task 1: Add a Boolean Variable to the Development Environment High Level Steps 1. add a new column to the end. e. On the Variables tab. a. C/AL Globals. Add a Boolean Variable to the development environment. on a blank line. Type GraphicalInventory as the Data Source. you will continue designing the Item Catalog. Save and compile the report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Close the report dataset designer. Additionally. In the report dataset designer. e. Select Column as the Data Type. You will use expressions to change visibility options and formatting. Detailed Steps 1. h. On the third line. Select Field in the Type column. Embed the Images in the Report. Because the report did not contain a request page yet. i. In the Images folder. d.png. select Group. Design the Request Options page. b. The Request Options Page Designer will be opened. b. c. l. e. Task 4: Embed the Images in the Report High Level Steps 1. In the SourceExpr column. a. Click the Close button in the upper-right corner to close the Request Options Page Designer. Detailed Steps 1. select Container in the Type and ContentArea in the SubType column. Browse to the folder containing select InvGreen.Module 3: Adding Code to a Report Task 3: Design the Request Options Page High Level Steps 1.71 . Detailed Steps 1. Select View. k. Design the Request Options page. enter Options in the Caption column. Click Open to import the image. Request page. Select the Add Image menu. j. f. f. enter Graphical Inventory in the Caption column. On the first blank line. a. Open the report in the Object Designer. In the Images folder. e. enter GraphicalInventory. c. Save and compile the report. Open the report in Visual Studio Report Designer. In the Type and SubType column. d. enter “My Request Page” in the Caption column. Select View Report Data. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . g. On the second line. Embed the Images in the Report. the window is blank. On the same line. Select the Add Image menu. Task 5: Add an Additional Table Header Row High Level Steps 1. In the first detail row. Right-click the row handle for the table detail row and select Insert Row – Inside Group . Right-click the row handle for the table header row and select Insert Row Below.Below. Detailed Steps 1. The table detail row will be duplicated. In the Images folder. a. c.Reporting in Microsoft Dynamics® NAV 2013 g. k. b. 3 . Add an additional table detail row. Click Open to import the image. i. Select the Add Image menu. Add an Additional Table Header Row. b. Click the cell containing the No_ItemCaption in the table header row. j. Click Open to import the image. Add an Additional Table Header Row. Select the sixth cell on the header row. Add an additional table detail row. f.72 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .png. a. Task 6: Add an Additional Table Detail Row High Level Steps 1. e. d. Detailed Steps 1.png. Select the first cell on the newly added detail row and press Ctrl+V. set the BackgroundColor property to No Color. Browse to the folder containing select InvRed. c. In the Properties window. h. In the first header row. Select the first cell on the newly added header row and press Ctrl+V. select the first five cells and press Ctrl+C to copy the selection to the clipboard. Browse to the folder containing select InvCross. select all cells and press Ctrl+C to copy the selection to the clipboard. "InvRed". In the Toolbox window. Drag it to the Inventory column on the second detail row. Detailed Steps 1. c. Fields!Inventory_Item. Select the newly added Image control. Fields!Inventory_Item.Value > 0. Select the cell containing the Inventory field on the newly added table detail row. Task 9: Set the Value Property of the Inventory Image High Level Steps 1. Adjust the new table detail row. Adjust the new table detail row. Select the cell containing the image control on the newly added table detail row. select the Image control. a. Task 8: Add an Image Control for the Inventory Field High Level Steps 1. Add the Image control for the Inventory field. Detailed Steps 1. In the Properties window.Value < 0. Press Delete to clear the table cell.73 . In the Properties window. Detailed Steps 1. "InvCross". Set the Value Property of the Inventory image. Add the Image control for the Inventory field. d. set the Value property to the following expression: =Switch(Fields!Inventory_Item. Click Ok. a.Value = 0. d. a.Module 3: Adding Code to a Report Task 7: Adjust the New Table Detail Row High Level Steps 1. b. set the Source property to Embedded. b. b. "InvGreen") Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . Delete the Image control. c. Set the Value Property of the Inventory image. >.74 Change the Visibility of the Table Detail Row. a. True. i. field in the first table detail row. select <Expression. b. Change the Visibility of the Table Detail Row. a. Click the row handle for the first table header row to select the whole table row. In the Properties window. In the Properties window. Click the cell containing the Item No. In the Expression window. enter the following expression: =Iif(Fields!GraphicalInventory. Detailed Steps 1. f. Click OK to close the Expression window. True) e. expand the Visibility property collection. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .. The table row handle will now be displayed.. False) j. c. h. caption in the second table header row (the row that does not include the Picture caption). d. Change the Visibility of the Table Header Row. enter the following expression: =Iif(Fields!GraphicalInventory.Value = 0. caption in the first table header row (the row including the Picture caption). In the Hidden property. g. The table row handle will now be displayed. Task 11: Change the Visibility of the Table Detail Row High Level Steps 1. expand the Visibility property collection. Click OK to close the Expression window. Click the row handle for the first table detail row to select the entire table row. Detailed Steps 1.Value = 0.. Change the Visibility of the Table Header Row. b. Click the cell containing the Item No.. False. 3 . In the Hidden property. Click the row handle for the second table header row to select the entire table row.>. select <Expression. The table row handle will now be displayed. Click the cell containing the Item No. In the Expression window.Reporting in Microsoft Dynamics® NAV 2013 Task 10: Change the Visibility of the Table Header Row High Level Steps 1. In the Properties window. h. enter the following expression: =Iif(Fields!GraphicalInventory. Click the cell containing the Item No. Click OK to close the Expression window. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . In the Expression window. "LightBlue". i. The table row handle will now be displayed. In the Hidden property. In the Properties window. Change the alternating colors for the Table Detail Row. false) j.. expand the Visibility property collection. false. enter the following expression: =Iif(RowNumber(Nothing) Mod 2 = 0..>. a. true. select the text boxes containing the No.>.75 . in the BackgroundColor property. f.Module 3: Adding Code to a Report c. In the Expression window.. Click OK to close the Expression window. select <Expression.. Base Unit of Measure and Unit Price fields. Task 12: Change the Alternating Colors for the Table Detail Row High Level Steps 1.. Click the row handle for the second table detail row to select the entire table row. In the Hidden property. d.>.Value = 0. Description. select <Expression. b. Detailed Steps 1. On the second detail row of the table control. enter the following expression: =Iif(Fields!GraphicalInventory. expand the Visibility property collection. g. true) e. select <Expression. in the second table detail row (the row that does not include the Picture field). "Transparent") c. Change the alternating colors for the Table Detail Row. In the Properties window.. In the Expression window.Value = 0. Click OK to close the Expression window. 76 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Run the report from the File. Detailed Steps 1. a. d. the result resembles the figure ITEM CATALOG WITH IMAGES. Save and import the RDLC changes. Run menu. Run the report. Run the report. The Request Page of the report now shows an option called "Graphical Inventory. Exit Visual Studio. at the beginning of the lab.Reporting in Microsoft Dynamics® NAV 2013 Task 13: Run the Report High Level Steps 1." If you check the option. 3 . Save and compile the report in the Report Designer. c. b. Exercise 1: Step by Step Task 1: Delete the Embedded Company Logo from the Report High Level Steps 1. you will replace the embedded company logo by the picture that is stored in the Microsoft Dynamics NAV database. Select View. Additionally. Additionally. you introduced the Graphical Inventory option. You created multiple header and detail rows that are printed. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . there are empty lines in between every two detail rows. a. you will replace the embedded company logo by the company logo that is stored in the Microsoft Dynamics NAV database. Delete the embedded company logo from the report.2 Adding Conditional Formatting to a Report. depending on the selected option. Data. b.3: Cleaning Up the Report and Using the Company Logo from the Database Scenario In Lab 3. Objectives In this lab. You will add controls to the body section and use the company logo information in the header section. Report.77 . You will solve these issues by using custom code and variables. you will use custom code to finish report. and use the Delete button to remove the image. In the Images folder. to solve multiple end-user requests with one report. Delete the embedded company logo from the report. Because of this. Detailed Steps 1. select the Cronus Company logo. when you print the report that has Graphical Inventory information.Module 3: Adding Code to a Report Lab 3. Add the report execution time. Detailed Steps 1. a. Detailed Steps 1. select the Text box control and drag it to the Page Header section. 3 . set the Value property to the following expression: =First(Fields!CompanyPicture. In the Properties window. the page number and the total number of pages to the header.LongDate) Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In the Toolbox window. Add the database picture to the page header. d. In the Properties window. b. In the Toolbox window. In the Properties window.Reporting in Microsoft Dynamics® NAV 2013 Task 2: Add the Database Picture to the Page Header High Level Steps 1. set the Value property to the following expression: ="Page " & Globals!PageNumber & "/" & Globals!TotalPages. d. set the MIME Type property to image/bmp.78 Add the report execution time. In the Properties window. Add the database picture to the page header. c. set the Value property to the following expression: ="Date Printed: " & FormatDateTime(Globals!ExecutionTime. In the Properties window. under the Image control. b. c. "DataSet_Result") Task 3: Add the Report Execution Time. DateFormat.Value. Select the Image control in the page header section. a. the page number and the total number of pages to the header. the Page Number and the Total Number of Pages to the Header High Level Steps 1. set the Source property to Database. select the Text box control and drag it to the Page Header section. Select a text box in the third row of the Tablix to visualize the row handler. p. In the Row Visibility window. enter the following expression: i. Detailed Steps 1. =Iif(Fields!GraphicalInventory.Value = 0. =Iif(Fields!GraphicalInventory. g. f. True. False. Update the Tablix control visibility settings. Select the OK button to close the Expression Editor. Right-click the row handler and select the Row Visibility option. Select the OK button to close the Row Visibility window. Right-click the row handler and select the Row Visibility option. In the Row Visibility window. True) d. e.Module 3: Adding Code to a Report Task 4: Update the Tablix Control Visibility Settings High Level Steps 1. enter the following expression: i. Select the OK button to close the Expression Editor. Right-click the row handler and select the Row Visibility option. Select the OK button to close the Row Visibility window. c. Select the OK button to close the Expression Editor.Value = 0. Select a text box in the first row of the Tablix to visualize the row handler. In the Row Visibility window. False) i.Value = 0.79 . =Iif(Fields!GraphicalInventory. enter the following expression: i. in the property Show or hide based upon an expression. Select the OK button to close the Row Visibility window. m. Update the Tablix control visibility settings. h. in the property Show or hide based upon an expression. False. True) n. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . l. a. Select a text box in the second row of the Tablix to visualize the row handler. j. o. in the property Show or hide based upon an expression. Select a text box in the fourth row of the Tablix to visualize the row handler. k. b. Run menu. in the property Show or hide based upon an expression. Save and compile the report in the Report Designer. Detailed Steps 1. Run the report. Task 5: Run the Report High Level Steps 1. a. enter the following expression: i. 3 .80 Run the report. b. =Iif(Fields!GraphicalInventory. t. False) s. In the Row Visibility window.Reporting in Microsoft Dynamics® NAV 2013 q.Value = 0. Right-click the row handler and select the Row Visibility option. r. Exit Visual Studio. Run the report from the Start. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Select the OK button to close the Row Visibility window. Save and import the RDLC changes. c. d. Select the OK button to close the Expression Editor. True. it provided a better understanding of the sales invoice report. Can nested IiF() statements be used? ( ) No.81 . Test Your Knowledge Test your knowledge with the following questions. ( ) Yes. dates and numbers • Visibility options to implement show and hide interactivity effects • Code for optimal data retrieval • Grouping expressions The module also described how to add custom code and custom variables to a report. Additionally. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . 1. Which decision functions can be used in expressions in Visual Studio Report Designer? ( ) Iif() ( ) Switch() ( ) Case() ( ) Select Case() 2. but only up to two levels.Module 3: Adding Code to a Report Module Review Module Review and Takeaways This module described how to create and use expressions in a report for different purposes: • Formatting of strings. ( ) Yes ( ) None of the answers is correct. ( ) Expressions can be used for formatting. ( ) Custom Code is available in the Expression window when you use the Code collection. "\")) ( ) You cannot do this because the Reportviewer does not use Windows accounts. 3 .Reporting in Microsoft Dynamics® NAV 2013 3.InStr(User!UserID. Which function is used to identify the row number in a data region control? ( ) Row ( ) RowNo ( ) RowNumber ( ) NoRow 4. 5. Len(User!UserID) . ( ) Expressions can be used to determine the visibility of controls. What is true about Custom Code in a report? ( ) Functions that are defined in the C/AL are automatically added to the RDLC report layout when you use the Create Layout Suggestion option. ( ) Expressions cannot be used to insert page breaks in a report. ( ) Custom Code can be added in various areas in Visual Studio Report Designer. ( ) Custom Code must be added by using Visual Basic syntax.InStr(Report!UserID. Len(USERID)) ( ) =Right(User!UserID. "\")) ( ) =Right(Report!UserID. What is not true about expressions? ( ) Expressions can be used for sorting.82 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . 6. Which expression returns the name of the Windows user (without the domain name) that is running a RDLC report? ( ) =Right(USERID. Len(Report!UserID) . Module 3: Adding Code to a Report Test Your Knowledge Solutions Module Review and Takeaways 1. but only up to two levels. (√) Yes ( ) None of the answers is correct.InStr(User!UserID. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 3 . Len(User!UserID) . Which decision functions can be used in expressions in Visual Studio Report Designer? (√) Iif() ( ) Switch() ( ) Case() ( ) Select Case() 2.InStr(Report!UserID. Which function is used to identify the row number in a data region control? ( ) Row ( ) RowNo (√) RowNumber ( ) NoRow 4. Len(USERID)) (√) =Right(User!UserID. Len(Report!UserID) . Which expression returns the name of the Windows user (without the domain name) that is running a RDLC report? ( ) =Right(USERID. "\")) ( ) =Right(Report!UserID.83 . 3. ( ) Yes. Can nested IiF() statements be used? ( ) No. "\")) ( ) You cannot do this because the Reportviewer does not use Windows accounts. Reporting in Microsoft Dynamics® NAV 2013 5. ( ) Custom Code can be added in various areas in Visual Studio Report Designer. ( ) Expressions can be used for formatting.84 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . 3 . What is not true about expressions? ( ) Expressions can be used for sorting. 6. ( ) Custom Code must be added by using Visual Basic syntax. (√) Custom Code is available in the Expression window when you use the Code collection. ( ) Expressions can be used to determine the visibility of controls. What is true about Custom Code in a report? ( ) Functions that are defined in the C/AL are automatically added to the RDLC report layout when you use the Create Layout Suggestion option. (√) Expressions cannot be used to insert page breaks in a report. MODULE 4: DESIGN CONSIDERATIONS Module Overview This module contains a more detailed analysis of some advanced report features; such as dashboard reports and green bar reports. Additionally, the module covers the different export possibilities and the rendering differences. The lessons require that you are familiar with the techniques taught in previous modules. Objectives The objectives are: • Apply green bar effects and create dashboard reports. • Understand how a report will be rendered when it is exported to an Excel spreadsheet or a PDF file. • Apply some helpful information that can be useful when you design reports. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4-1 Reporting in Microsoft Dynamics® NAV 2013 Report Patterns and Recipes This lesson describes some typical challenges that you can encounter when you develop reports. It shows how to combine the techniques from previous modules to build more advanced reports. Green Bar Matrix The term "green bar report" refers to a continuous paper form that is typically used to print reports. The paper form has pre-printed white and light green areas to increase its readability. A green bar report prints rows or row groups with alternating background colors. The “Adding Code to a Report” module explains how you can define alternating background colors in table controls by setting the BackgroundColor property to an expression. Code Example =IIF(RowNumber("table1") Mod 2 = 0, "LimeGreen", "Transparent") The expression uses the RowNumber() function and the Mod operator to calculate the correct background color. If you want to create a green bar report by using a Matrix control, the technique illustrated in the “Adding Code to a Report” module cannot be used. This is because every row in a matrix control must be a group. There is currently no GroupNumber() function on which to base a green bar calculation. But a GroupNumber function can be simulated by using the RunningValue function to receive a running distinct count of group expression values. Code example =IIF(RunningValue(Fields!Country.Value,CountDistinct,Nothing) Mod 2, "AliceBlue", "White") Because the matrix generates column cells dynamically, you cannot specify a different expression for each column. Additionally, some cells in the matrix can contain no data at all, and this causes the group number calculation to be wrong for the empty cells. To work around this, you must effectively calculate the group number in the row header and then use that value inside the data cells. You can do this by using a small custom code function or by using the RunningValue function. 4-2 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 4: Design Considerations Method 1: The Custom Code Function The first method uses a small custom code function: Code example Private bOddRow As Boolean Public Function AlternateColor(ByVal OddColor As String, ByVal EvenColor as String, ByVal Toggle As Boolean) As String If Toggle Then bOddRow = Not bOddRow End If If bOddRow Then Return OddColor Else Return EvenColor End If End Function The function has three parameters: a color for odd rows, a color for even rows and a Boolean toggle parameter. The toggle parameter is used to indicate the start of a new row. Typically it will be set to True on the first cell and set to False on all other cells of the matrix row. With each new value that is printed in the column (after each row group), the Toggle parameter changes and the function returns another color. Therefore, all cells in a row group will have the same color. Method 2: The RunningValue() Function The second method uses the RunningValue() function: Code example =IIF(RunningValue(Fields!Item__No__.Value,CountDistinct,Nothing) Mod 2, "PaleGreen", "White") The RunningValue() function returns a running aggregate of the specified expression. The function has three parameters: a group expression, an aggregate function and a scope. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4-3 Reporting in Microsoft Dynamics® NAV 2013 The first parameter contains a group expression that you want to perform the aggregate function on. The expression cannot contain aggregate functions. The second parameter is the aggregate function that you want to apply to the group expression. This function cannot be RunningValue, RowNumber, or Aggregate. The third parameter, scope, refers to the dataset, grouping, or data region that contains the report items to apply the aggregate function to. If a dataset is specified, the running value is not reset throughout the whole dataset. If a grouping is specified, the running value is reset when the group expression changes. If a data region is specified, the running value is reset for each new instance of the data region. In this second method, the result of the previous expression is stored in an invisible text box named Color. Next, the BackgroundColor property of the other cells will be set to refer to the invisible text box by using the following expression: Code example =ReportItems!Color.Value The following demonstrations show how to use both methods. Demonstration: Create a Green Bar Matrix with a Custom Code Function Ellen asks Mort to improve the readability of the report. Instead of having the item number displayed on an orange background, she asks Mort to have the inventory amounts printed with alternating background colors. She also prefers a lighter pastel background color (PaleGreen). Demonstration Steps 1. 4-4 Add the GreenBar effect to the report. a. Open the CRONUS International Ltd. demonstration company. b. Select Tools, Object Designer to open the Object Designer. c. Select File, Import. d. Browse to report R123456701.fob. e. Click OK to start the import. f. In the dialog box, select to open the Import Worksheet window. g. In the Action column, verify that the action is set to Create. h. Click OK to import the object in the database. i. Open report 123456701 in Microsoft Visual Studio® Report Designer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 4: Design Considerations j. Select Report, Report Properties. k. On the Code tab, add the following code if it’s not already present and review the code. Code example Private bOddRow As Boolean Public Function AlternateColor(ByVal OddColor As String, ByVal EvenColor as String, ByVal Toggle As Boolean) As String If Toggle Then bOddRow = Not bOddRow End If If bOddRow Then Return OddColor Else Return EvenColor End If End Function l. Click OK to close the Report Properties window. m. Select the cell that contains the Item No. and Description field. It’s on the second row, first column. n. In the Properties window, change the BackgroundColor property to the following expression: =Code.AlternateColor("PaleGreen","White", True) o. Select the cell that contains the Inventory amounts. This is the textbox on the second row, last column. p. In the Properties window, change the BackgroundColor property to the following expression: =Code.AlternateColor("White", "PaleGreen", False) q. Select the cell on the first row, first column. r. In the Properties window, change the BackgroundColor property to No Color. s. Select the rectangle Rectangle1 in the properties window. t. In the Properties window, change the BackgroundColor property to No Color. u. In the properties window, select textbox Color. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4-5 Reporting in Microsoft Dynamics® NAV 2013 v. Set the Width property to 0cm. w. Exit Visual Studio, import the new RDLC layout in the object, save the object and run it. x. Click the Print Layout button in the toolbar of the Report Viewer window. The result will resemble this: FIGURE 4.1: THE GREEN BAR MATRIX WINDOW 2. 4-6 In the previous figure, Mort notices that the item number is also printed with the alternating background colors. To change this, he inserts a hidden column. a. Open report 123456701 in Visual Studio Report Designer. b. In the Row Groups window, select the option Add Group, Child Group on the row that contains the Item No. field. c. In the Tablix group window, set the Group by field to the same expression as the cell that contains the Item No. In this case, select [Item__No__]. d. Click OK to close the window. e. Select the newly added row group cell. (on the second row, second column) f. In the Properties window, set the BackgroundColor property to the following expression: =Code.AlternateColor("PaleGreen","White", True) g. Select the cell that contains the Group1. h. In the Properties window, set the BackgroundColor property to No Color. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 4: Design Considerations i. Resize the column width to a Width of 4cm. j. Right click the first Column in the Tablix and click Delete. When asked click Ok to delete the associated groups. k. In the textbox on the first row, first column type Item No. l. Exit Visual Studio, import the new RDLC layout in the object, save the object and run it. The result will resemble this: FIGURE 4.2: THE GREEN BAR MATRIX WITH A HIDDEN COLUMN WINDOW Demonstration: Create a Green Bar Matrix with RunningValue() In this demonstration, you will use the RunningValue function to create a green bar matrix. Demonstration Steps 1. To add the GreenBar effect to the report that uses the RunningValue function follow these steps. a. Open the CRONUS International Ltd. demonstration company. b. Select Tools, Object Designer to open the Object Designer. c. Select File, Import. d. Browse to report R123456701.fob. e. Click OK to start the import. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4-7 Reporting in Microsoft Dynamics® NAV 2013 f. In the dialog box, select to open the Import Worksheet window. g. In the Action column, verify that the action is set to Create. h. Click OK to import the object in the database. i. Open report 123456701 in Visual Studio Report Designer. j. Select the row header cell (the cell that contains the Item No. field). k. Press Delete to clear the cell. l. Right-click the Item__No__ text box and select Expression. m. In the Expression window, verify the following expression is correct: =Fields!Item__No__.Value & Fields!Item_Description.Value n. In the Properties window, select the Textbox Color. o. In the Properties window, verify that the Hidden property of the Color text box is True. p. In the Properties window, verify the Value property of the Color textbox is set to the following expression: =IIF(RunningValue(Fields!Item__No__.Value,CountDistinct,Nothin g) Mod 2, "White", "PaleGreen") q. Select the rectangle Rectangle1 control in the properties window. r. In the Properties window, verify that the BackgroundColor property is set to the following expression: =ReportItems!Color.Value s. Select the Item_Ledger_Entry_Quantity matrix cell. t. In the Properties window, verify that the BackgroundColor property is set to the following expression: =ReportItems!Color.Value u. In the textbox on the first row, first column, type: Item No. v. In the properties window, select textbox Color. w. Set the Width property to 0cm. x. 4-8 Exit Visual Studio, import the RDLC report layout, save and compile the report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement you can build your own dashboard reports by combining information from different areas in a single (report) interface. With the new reporting solution. Also. a dashboard report is a way to visually present important data in summary form so that you can make quick and effective decisions. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4-9 . features such as interactive analysis and views.3: THE GREEN BAR MATRIX WITH THE RUNNINGVALUE FUNCTION WINDOW Dashboards Essentially. charts and indicators can be added.Module 4: Design Considerations The result will resemble this: FIGURE 4. indented data items can be added to perform additional data processing or grouping. The report dataset designer will also contain the necessary fields.10 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . and is also filtered so that it only shows a subset of data.4: SALES DASHBOARD REPORT DIAGRAM The dashboard contains two charts that give instant access to the top five (5) customers who are based on Total Sales and Balance Due in local currency (LCY)). In some cases. Dashboard Report Structure The basic structure of a dashboard report typically includes multiple data items without any indentation. a toggle button is used to show or hide the order details. At the bottom of the report. only the Top X for specific areas will display. it contains a chart with the total amount of outstanding orders in LCY.Reporting in Microsoft Dynamics® NAV 2013 Frequently. Instead of having the full details display on all records in different tables. Additionally. The Grouping And Sorting Properties Window figure shows a typical example of a sales dashboard. 4 . FIGURE 4. a dashboard presents information from different tables by using charts. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . When you add a chart to the report body. When the chart control is added to the report. you first select the type of chart to use. Chart Elements The following illustration shows many of the different elements used in a chart. FIGURE 4.Module 4: Design Considerations Dashboard Report Design Dashboard reports frequently use charts and images to present data. you can continue to design it. You can add a chart in a report by inserting chart controls in the body section. To do this.11 . right-click the chart control and select Properties to open the Chart Properties window.5: ELEMENTS OF A CHART DIAGRAM A Chart data region has many properties. However. Category and Data will appear. the data will be easier to read when you use a chart type that is suitable to your data. The chart is also closely related to the matrix.6: SELECT CHART TYPE POPUP WINDOW Each chart type has unique characteristics to help you visualize your dataset. you can drag report dataset fields for numeric and non-numeric data to the drop zones of the chart. based on what you are trying to show in your report. 4 . an aggregate is calculated for the field. When you select the chart on the design surface.com/fwlink/?LinkId=267281 After you add a Chart data region to the design surface. You can use any chart type to display your data. You can also use series grouping to dynamically generate series. three drop zones Series. The fields from your dataset appear in the Report Data pane. Drag your fields from the dataset into the appropriate drop zone. By default. Additional Reading: For more information about chart types please read: http://go. when a field is added to one of the field drop zones of the chart.Reporting in Microsoft Dynamics® NAV 2013 FIGURE 4.12 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .microsoft. many of these properties can also be set from a dialog box. • The Data field drop zone on the matrix is identical to the data field drop zone on the chart. These three features produce the largest visible change on the chart. located in the Properties pane. you can specify series-specific properties by using custom attributes.13 . If you are formatting the series. Legend. They define the drawing style of data points. depending on where you rest the pointer. and Series have their own property list. doughnut. For example. you can select the Color palette. The different elements of a chart. Area.Module 4: Design Considerations The chart behaves identically to the matrix template of the tablix control: • The Columns field drop zone on the matrix is identical to the category group drop zone on the chart. However. To effectively format the chart by using a minimal number of steps. All properties that relate to the chart are located in the Properties pane. Title. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . palette and drawing style. bar and column charts. in the Chart Properties window. in the General tab. you must change the default border style. Drawing styles are only applicable to pie. you can open the corresponding Property window. • The Rows field drop zone on the matrix is identical to the series group drop zone on the chart. When you select a chart. These can only be found in the CustomAttributes category of properties. filters for category groups and series groups are applied independently. because the dataset is provided by Microsoft Dynamics NAV 2013. In a chart. and then on the data region. However. filters for row groups. Filters are applied at run time first on the dataset. in top-down order for group hierarchies. data region and group filters can be added in Visual Studio Report Designer.7: CHART CUSTOM ATTRIBUTES PROPERTIES Data values. matrix. when you include or exclude specific values for calculations or display. or list. column groups. data region. or group. In a table. The Top X Filter You can add a filter to a dataset.14 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Reporting in Microsoft Dynamics® NAV 2013 FIGURE 4. Dataset filters cannot be added in Visual Studio Report Designer. 4 . and adjacent groups are applied independently. and then on the group. categories and series can be added to the chart by dragging fields from the dataset to the chart. Click the AssistEdit (…) button. type the expression or value against which you want the filter to evaluate the value in Expression. 3. Click the Filters tab. Setting Filters on a Chart Category Group To add a filter to a chart category group.15 . Click an empty line. A new blank filter equation appears. By default. Open a report in Visual Studio Report Designer. 1. 4. In Expression. 7. To edit the expression. Open a report in Visual Studio Report Designer. type the expression or value against which you want the filter to evaluate the value in Expression. follow these steps. In Expression. select the operator that you want the filter to use to compare the values in the Expression box and the Value box. select the operator that you want the filter to use to compare the values in the Expression box and the Value box. follow these steps. 3. In the Value box. In the Category group field. and then click Properties to open the <data region> Properties window. 1. Right-click the data region control and select Properties. This displays the current list of filter equations. the list is empty. By default. A new blank filter equation appears. type or select the expression for the field to filter. click the expression (fx) button. 5. To edit the expression. In the Value box. type or select the expression for the field to filter. 2. 8. In the Operator box. Right-click the data region on the design surface. Click an empty line. 7. select the group to filter. This displays the current list of filter equations. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . click the expression (fx) button. the list is empty. 9. In the Operator box. Click the Filters tab. 5. The operator you select determines the number of values that are used from the next step. 11. 6. Click OK. 6. 2. 10. Click OK.Module 4: Design Considerations Setting Filters on a Data Region Control To add a filter to a data region control. 4. 8. The operator you select determines the number of values that are used from the next step. Click the Data tab. Reporting in Microsoft Dynamics® NAV 2013 Setting Filters on a Chart Series Group To add a filter to a chart series group, follow these steps. 1. Open a report in Visual Studio Report Designer. 2. Right-click the data region control and select Properties. 3. Click the Data tab. 4. In the Series group field, select the group to filter. 5. Click the AssistEdit button. 6. Click the Filters tab. This displays the current list of filter equations. By default, the list is empty. 7. Click an empty line. A new blank filter equation appears. 8. In Expression, type or select the expression for the field to filter. To edit the expression, click the expression (fx) button. 9. In the Operator box, select the operator that you want the filter to use to compare the values in the Expression box and the Value box. The operator you select determines the number of values that are used from the next step. 10. In the Value box, type the expression or value against which you want the filter to evaluate the value in Expression. 11. Click OK. The following table shows some examples of filter equations. Simple Expression 4 - 16 Data Type Operator Value Description [SUM(Quantity)] Integer > 7 Includes data values that are greater than seven. [SUM(Quantity)] Integer TOP N 10 Includes the top 10 data values. [SUM(Quantity)] Integer TOP % 20 Includes the top 20 percent of data values. [Sales] Text > =CDec(100) Includes all values of type System.Decimal (SQL "money" data types) greater than $100 U.S. dollars (USD). [OrderDate] DateTime > 2088-01-01 Includes all dates from January 1, 2008 to the present date. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 4: Design Considerations Simple Expression Data Type [OrderDate] DateTime Operator Value Description BETWEEN 2008-01-01 Includes dates from January 1, 2008 up to and including February 1, 2008. 2008-02-01 [Territory] Text LIKE *east All territory names that end in "east". [Territory] Text LIKE %o%th* All territory names that include North and South at the beginning of the name. =LEFT(Fields!Subcat.Value,1) Text IN B, C, T All subcategory values that begin with the letters B, C, or T. Demonstration: Adding a Chart to a Report Demonstration Steps 1. To add a chart to a report follow these steps. a. Open the CRONUS International Ltd. demonstration company. b. Select Tools, Object Designer to open the Object Designer. c. Select File, Import. d. Browse to report R123456701.fob. e. Click OK to start the import. f. In the dialog box, select to open the Import Worksheet window. g. In the Action column, verify that the action is set to Create. h. Click OK to import the object in the database. i. Open report 123456701 in Visual Studio Report Designer. j. In Visual Studio Report Designer on the View menu, click Toolbox to display a list of report items that can be added to the report. k. Double-click the Chart object, or drag the Chart object to the design surface. The Select a Chart Type dialog box appears. l. Select the type of chart that you want to add. Click OK. m. Click the chart to display the drop-zones. n. Add one or more fields to the data field drop-zone. This information will be plotted on the value (y) axis. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 - 17 Reporting in Microsoft Dynamics® NAV 2013 o. On this zone usually numerical fields are used. By default they will be summarized with the Sum function. p. Add a field to the category field drop-zone by dragging it from the Dataset_Result onto the “Drop Series here” zone of the Chart. When you add this field to the series drop zone, a grouping field is automatically created for you. Each group represents a data point in your series. q. To summarize the data by category, drag a field from the Dataset_Result onto the “Drop Categorie fields here” zone and then right-clickthe newly added field and select Categorie Properties. In the Category box, select the category field from the drop-down list. Click OK. On charts with axes, such as bar and column charts, the category (x) axis might not display all the category labels. Demonstration: Creating a Tablix Report A Tablix is a flexible report item that can be used to display data in a grid format, with layout possibilities ranging from simple tables to advanced matrices. This demonstration will show how to create a tablix with adjacent groups, totals and subtotals. Demonstration Steps 1. 2. 4 - 18 Open the Microsoft Dynamics NAV 2013 demonstration database. a. Open the CRONUS International Ltd. demonstration company. b. Select Tools, Object Designer to open the Object Designer. c. Select File, Import. d. Browse to report R123456708.fob. e. Click OK to start the import. f. In the dialog box, select to open the Import Worksheet window. g. In the Action column, verify that the action is set to Create. h. Click OK to import the object in the database. Open report 123456708 in Visual Studio Report Designer. a. Open the Toolbox and add a table to the report body. b. In the detail row add the following field: Amount_CustLedgerEntry. c. Select the second and third columns by using the corresponding column handle and then click Delete. d. Select the first text box and set the FontWeight property to Bold. e. Select the tablix. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 4: Design Considerations 3. 4. f. In the Row Groups window, click the Details Row and select Add Group, Parent Group. g. In the Group by field, select [SalesPersonName]. h. Click OK to close the Tablix group window. i. For the first row, delete the contents of the first text box. Add a group on [CustomerNo_CustLedgerEntry]. a. Select the tablix. b. In the Row Groups window, click the Details Row and select Add Group, Parent Group. c. In the Group by field, select [CustomerNo_CustLedgerEntry]. d. Click Ok to close the Tablix group window. e. For the first row, delete the contents of the second text box. Create an expression for Salesperson. a. Right-click the first text box for the second row and select Expression. b. In the Expression text box, enter the following expression: =Fields!SalesPersonName.Value & " (" & Fields!SalespersonCode_CustLedgerEntry.Value & ")" 5. Create an expression for CustomerName. a. Right-click the second text box of the second row and select Expression. b. In the Expression text box, enter the following expression: =Fields!CustomerNo_CustLedgerEntry.Value & " " & Fields!CustomerName.Value 6. 7. Set the width of the first two text boxes. a. Set the Width property of the first text box to 3.4925cm. b. Set the Width property of the second text box to 6.37647cm. Create a group on the Year of the posting date. a. From the Report Data window, select the field PostingDate_CustLedgerEntry and drag it into the Column Groups window. b. Open the Group Properties of the newly added column group. c. In the Group Expression, change the Group On expression to the following: =Year(Fields!PostingDate_CustLedgerEntry.Value) Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 - 19 Reporting in Microsoft Dynamics® NAV 2013 d. Right-click the third text box for the first row and select Expression. e. In the Expression text box enter the following expression: =Year(Fields!PostingDate_CustLedgerEntry.Value) 8. 9. Create a group on Document Type. a. In the Column Groups window, click Add Group, Adjacent After. b. In the Tablix group window, set the Group by field to the following: [DocumentType_CustLedgerEntry]. c. Click OK to close the Tablix Groups window. d. For the third row, in the fourth text box select: [Amount_CustLedgerEntry] Create a header row for column titles. a. Right-click the row handle for the second row (the middle row) and select: Delete Rows. b. Right-click the row handle for the first row and select: Insert Row, Outside Group, Above. c. In the third text box of the newly added first row type: Year. d. In the fourth text box of the newly added first row type: Type. e. Set the property TextAlign of the text boxes in the first row to Center. 10. Create a total for Amount. a. In the Column Groups window, select group 3 and click Add Group, Adjacent After. b. In the Tablix group window, set the Group by field to ALL. To do this type ALL in the Group by field. c. As an alternative, select the Fx button. The Expression editor opens. Type in the following expression: ="ALL" d. Click OK to close the Column Groups window. e. In the last text box of the first row, right-click and select: Split Cells. f. In the fifth text box of the first row type: Grand Total. g. Select the fifth text box of the second row and then click Delete. h. In the fifth text box of the third row, enter the expression: =Sum(Fields!Amount_CustLedgerEntry.Value) 4 - 20 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 4: Design Considerations 11. Create a group total row. a. In the Row Groups window, on the first line, select Add Total, After. b. In the newly added row, in the first text box, change the value to Grand Total. c. Select the row handle for the last row in the tablix and then click the B button in the Report Formatting toolbar. d. In the Value Expression of the third and fourth text box, on the last row, type the following expression: =Sum(Fields!Amount_CustLedgerEntry.Value) e. On the second row, delete the contents of the last text box. 12. Set the BackGroundColor. a. Set the BackGroundColor property of the text boxes of the last row and the last column to Khaki. b. Set the BackGroundColor property of the text boxes of the third column, first and second row to DarkOliveGreen. c. Set the BackGroundColor property of the text boxes of the fourth column, first and second row to Olive. d. Set the Format property of the six text boxes that contain Amounts to the following expression: Fields!Amount_CustLedgerEntryFormat.Value 13. Change the visibility settings for Group3. a. In the Row Groups window, open the properties of Group 2. b. In the Visibility tab, set the option When the report is initially run to Hide. c. Set the Display can be toggled by this report item to Group1. d. Click OK to close the Group Properties window. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 - 21 Reporting in Microsoft Dynamics® NAV 2013 14. Save and Run the report. a. Exit Visual Studio, import the RDLC report layout, and then save and compile the report. The result will resemble this: FIGURE 4.8: MATRIX REPORT WITH ADJACENT GROUPS AND TOTALS SCREEN SHOT Demonstration: Simulating Transheader and Transfooter In earlier versions, you could use a transheader and transfooter in reports. Transfooters show the current subtotals through the end of the current page or the sum for each page. These sections are not available in RDLC reports in Microsoft Dynamics NAV 2013. However, this demonstration will show how to achieve the same functionality in RDLC reports. Demonstration Steps 1. 4 - 22 Import the demonstration report. a. Open the Microsoft Dynamics NAV 2013 demonstration database. b. Open the CRONUS International Ltd. demonstration company. c. Select Tools, and Object Designer to open the Object Designer. d. Select File, Import. e. Browse to report R123456707.fob. f. Click OK to start the import. g. In the dialog box, select to open the Import Worksheet window. h. In the Action column, verify that the action is set to Create. i. Click OK to import the object in the database. j. Open report 123456707 in Visual Studio Report Designer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 4: Design Considerations 2. Add the transheader and transfooter to the report. a. Open the Toolbox and add a table to the report body. b. In the detail row, add the following fields: Customer No, Customer Name, Debit Amount. c. Add a total row to the table by selecting the Details in the Row Groups section and then by clicking the option Add Total, After. d. In the total row, in the text box on the third column enter the following expression: ="Grand total: " & Sum(Fields!DebitAmount_Customer.Value) e. Add a Page Header to the report. f. Add a Page Footer to the report. g. In the Page Header add a text box from the toolbox. h. Move this textbox to the bottom of the Page Header and make it the same Width as the Width of the first column in the table in the body of the report. i. In the Page Footer add a text box from the toolbox. j. Move this textbox to the top of the Page Footer and make it the same Width as the Width of the first column in the table in the body of the report. k. In the text box of the Page Header enter the following expression: ="Transheader subtotal = " & Code.GetRunningTotal(Globals!PageNumber-1) l. In the text box of the Page Footer enter the following expression: ="Transfooter subtotal = " & Code.SetRunningTotal( Sum(ReportItems!DebitAmount_Customer.Value), Globals!PageNumber) m. In the Hidden property of the text box in the Page Header enter the following expression: =IIF(Globals!PageNumber > 1, False, True) n. In the Hidden property of the text box in the Page Footer enter the following expression: =IIF(Globals!PageNumber < Globals!TotalPages, False, True) o. Set the BackGroundColor of the text box in the Page Header to DarkOliveGreen. p. Set the Color of the text box in the Page Header to White. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 - 23 Reporting in Microsoft Dynamics® NAV 2013 3. c. import the RDLC report layout. Use the < and > buttons in the report viewer toolbar to view the different pages. b. Save and Run the report. Exit Visual Studio. Select the Print Layout button in the Report Viewer window on the toolbar. Set the Color of the text box in the Page Footer to White. q. s.24 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . r.9: RUNNINGVALUE MIMIC TRANSHEADER AND TRANSFOOTER SECTIONS WINDOW 4 . Set the Color of the text box in the Page Header to White. and then save and compile the report. Run the report. The result will resemble this: FIGURE 4. d. a. Set the BackGroundColor of the text box in the Page Footer to SteelBlue. If your report uses a list. • Documents created by the Excel renderer are not in the Office 2007 XLSX file format. Lesson Objectives Examine how reported layouts will be rendered when you export to Excel. Therefore. The items in the report table will line up as they are expected to when they are rendered in Excel. Using Tables Instead of Lists for Excel-specific Reports A table uses a fixed column width. Excel Rendering Report Viewer supports the rendering of reports for Microsoft Office Excel. In contrast. Items in the list are positioned in the worksheet in relation to their location in the report. • Rectangles are converted to groups of cells. • Specifying worksheet names is not supported. only explicitly defined page breaks will occur. you must check the rendering to Excel to determine whether the results are acceptable. However. Excel does not support the concept of page height and width. the rectangle becomes a region of cells. • Charts are rendered as pictures. The Excel rendering extension includes some unique attributes. a list is a freeform style. Excel 2007 can use the created document because Excel 2007 provides full support for the XLS format.Module 4: Design Considerations Report Rendering Considerations Report Viewer provides interactive reporting features that you can use when you work with a report at run time. and the border and background color of the rectangle are applied to the region of cells. These include the following: • Each page in the report becomes an Excel worksheet.25 . not as Excel charts. This could lead to unexpected results. not all the report export formats support the full range of interactive features. If rectangles contain other items. • The rendering extension builds a tabular structure out of the report. • Excel does not support background images for individual cells. PDF and Word. This matches well with the tabular format of Excel reports. However. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . • Excel does not support nested containers other than lists. com/fwlink/?LinkId=267282 Word Rendering Reports exported to Microsoft Office Word are displayed as a nested table that represents the report body. limited by available memory.Reporting in Microsoft Dynamics® NAV 2013 If you are using tables. Specifically. Text boxes and rectangles are each rendered as a cell within the table. and you have a header that spans multiple columns in a report. consider the following: • Document maps are rendered as PDF bookmarks. However. The text box value is displayed inside the cell. make sure that the left or right edges of the report item line up to minimize cell merging. PDF Rendering The portable document format (PDF) rendering extension creates reports that can be viewed by using Adobe Acrobat readers. the hierarchy is ignored.26 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Additional Reading: A good explanation of a report with a custom barcode font can be found here: http://go. if this is necessary. PDF viewers such as Adobe Acrobat are required for viewing or printing PDF reports. When you render a report. However. the Excel rendering extension maps the report colors to the best match in the natively supported colors in Excel. keep track of the number of pages in lengthy reports. When you design PDF reports output. the Excel rendering extension might have to merge cells or introduce new columns. Excel generates an error. In the document maps. each page in a report becomes a worksheet in Excel. 4 . page height and margins of the PDF. Excel can only support a maximum number of worksheets for each workbook. (All bookmarks will be on the same level. A Tablix data region is rendered as a nested table that reflects the structure of the data region in the report.) • Specify page width. If the report pages exceed that limit.microsoft. If you plan to render to Excel. This can affect the ability to sort and manipulate data in the Excel spreadsheet. Color Differences in Rendering to Excel Excel supports a predefined set of colors. Maximum Number of Pages in Long Reports To prevent Excel from generating an error. The rendering extension does not require Adobe software to render the report. However. Therefore. • Word ignores page header and footer height settings. some data might not be displayed in Print Layout view. Maps and areas that can be clicked in a chart are not supported. 24-bit colors. Microsoft Office Word 2007 can use the created document because Word 2007 provides full support for the DOC format. Hyperlinks and drillthrough links on these report items are rendered. • Reports can be viewed in Microsoft Word 1997 but the lay out will not appear correctly.27 . the report columns might not line up as expected. • When text is exported to Word. • Word supports a maximum page width of 22 inches wide and 22 inches high. Word limitations The following limitations are applied by Microsoft Word: • Word tables support no more than 63 columns. • After the report is exported. This can cause additional page breaks to be added to the rendered report. If your report has more than 63 columns and you try to render it. SAVEASEXCEL You can use the SAVEASEXCEL function on the Report type and on Report variables to save a report as a Microsoft Office Excel Worksheet. SAVEASPDF and SAVEASWORD Microsoft Dynamics NAV 2013 expands the C/AL functions SAVEASEXCEL and SAVEASPDF that were introduced in the previous version with a new function: SAVEASWORD. and gauges are each rendered as a static image in a table cell. text with font decoration in certain fonts can generate unexpected or missing glyphs in the rendered report. If your content is wider than 22 inches. charts. • Text boxes grow when they contain nonbreaking spaces. SAVEASEXCEL. It has the following syntax: Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . Word splits the table. • Documents created by the Word renderer are not in the Microsoft Office 2007 DOCX file format. Word 97 does not support nested tables. Newsletter-style column reports are not rendered in Word. Word paginates the report again.Module 4: Design Considerations Images. cell padding and possibly other features that are used by the Word renderer. The additional columns are positioned next to the 63 columns that are displayed in the report body. Report body and page background images and colors are not rendered. No PDF software is required to create PDF files. SAVEASWORD You can use the SAVEASWORD function on the Report type and on Report variables to save a report as a Microsoft Office Word file. FileName. at design time. Record]) [Ok :=] REPORT. If the report cannot be saved for a specific reason. the report is generated and saved to "FileName".Reporting in Microsoft Dynamics® NAV 2013 Code Example [Ok :=] REPORT. [. the report will not be generated or saved as an Excel Worksheet. SAVEASPDF You can use the SAVEASPDF function to save a report as a PDF file. The Saving to Excel window shows the status of the process. The Saving to PDF window shows the status of the process.28 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . The return value informs you whether the report is saved successfully. Other applications can call the web services to have reports generated. Also. FileName[.SAVEASEXCEL(FileName) When SAVEASEXCEL is called.SAVEASPDF(Number. Record]) [Ok :=] REPORT. It has the following syntax: Code Example Code Example [Ok :=] REPORT. the Request Page will not be shown. and use this variable when you call the SAVEASPDF function. If. set the Subtype of the variable to a specific report. It has the following syntax: 4 . then use the global REPORT object and specify the report number in the Number parameter.SAVEASEXCEL(Number. When you call SaveAsPDF. The function can also be used in codeunits that are exposed as web services.SAVEASPDF(FileName) You can use the SAVEASPDF function on the global REPORT object or on Report variables. then create a Report variable. the request page will not be shown. If you click Cancel. It has the same syntax as the SAVEASEXCEL function. you do not know the specific report that you want to run. If you do know which report that you want to run. the function will return False. the report is generated and saved to "FileName". Also. The Report Body The report body is a rectangular container displayed as white space on the design surface. depending on the rendering extension that you use to view and deliver the report. If you click Cancel. This topic will explain the effects of the physical page size and the report layout on how hard page break renderers must render the report. render reports that grow or decrease. HTML follows a specific set of pagination rules. depending on the contents of the page. Record]) [Ok :=] REPORT. Reports rendered in these formats are better for screen-based viewing. Understanding Pagination When you run a report in the report viewer. You can also add a background color and background image. FileName. The return value informs you whether the report is saved successfully. Word and HTML. Pagination Pagination refers to the number of pages in a report and how report items are arranged on these pages. such as Microsoft Excel.29 . These renderers add vertical page breaks when they are required. for example. To successfully design an easy-toread report that is better for the renderer. SAVEASWORD (FileName) When SAVEASWORD is called. Therefore the report may paginate differently. SAVEASWORD (Number. [.Module 4: Design Considerations Code example [Ok :=] REPORT. the report uses the HTML renderer. the Request Page will not be shown. Pagination in reports varies. border style and border width. such as in a web browser. If you export the same report to PDF. the PDF renderer is used and a different set of rules are applied. Some renderers. the report is generated and saved to "FileName”. You can format the report body so that there is a border color. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . The report body does not reflect the physical page size and. It can grow or decrease to accommodate the report items that are contained in it. If the report cannot be saved for a specific reason. then how you plan to deliver the report. the function will return False. in fact. the report body can grow beyond the boundaries of the physical page size to span multiple report pages. the report will not be generated or saved as a Word file. you must understand the rules that are used to control pagination. Also. The Saving to Word window shows the status of the process. To prevent empty pages from being added to your report. all the content within the report body must fit on the physical page. 4 . Reports rendered in hard page break formats insert page breaks horizontally and vertically. then a page break is inserted horizontally. it is clipped so that the overlapping area is not rendered. is not larger than the physical page size width. then a page break is inserted vertically. This is based on the physical page size and provides a better reading experience when the reports are printed or viewed in a hard page break file format. This is based on the physical size and provides a better reading experience when the reports are viewed in a web browser. By default. Reports rendered in soft page break formats insert page breaks horizontally. If the report body grows past the right side edge of the physical page. If it does not fit and you use the hard page break format.30 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . you can reduce the container size by dragging the container corner to the left. the margin settings will default to zero. If you specify margin sizes that cause the horizontal or vertical width of the page to equal zero. If the report body grows past the bottom edge of the physical page. check that the width of the report body (and this includes margins). LeftMargin and RightMargin properties in the Properties pane. If you want to override the margin size that is defined in the report.5 x 11 inches but you can change this size by using the Report Properties. Margins are specified by using the Report Properties. BottomMargin. Page Setup dialog box or by changing the TopMargin. and it renders across multiple pages. you can specify the margin size by using the Device Information settings for the specific renderer that you are using to export the report.Reporting in Microsoft Dynamics® NAV 2013 Note: If you have designed a report to be one page wide. then the report will require additional pages. If a report item extends into the margin area. the page size is 8. The paper size that you specify for the report controls how the report is rendered. Page Setup dialog box or by changing the PageHeight and PageWidth properties in the Properties pane. The page size does not grow or decrease to accommodate the contents of the report body. Margins Margins are drawn from the edge of the physical page dimensions inward to the specified margin setting. The Physical Page The physical page size is the paper size. If you want the report to appear on a single page. column spacing. Margins are only applied when you render and print reports in hard page break renderer formats. The Source Image File Instructions figure indicates the margin and usable page area of a physical page. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . and the page header and footer.31 .Module 4: Design Considerations The area of the physical page that remains after space is allocated for margins. Note: Note that once page the page header and page footer have been set for the document the space defined for them is ALWAYS allocated and never released to accommodate more rows from the “usable page area”. This can have an effect on the development of document reports were it can result in blank pages. is called the usable page area. 32 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . repagination can cause the exported report to have two successive page breaks in a row or add blank pages. This renderer supports only logical page breaks. Soft page breaks are inserted automatically by word processing programs such as Microsoft Word and Excel. in some instances. Excel uses the default page size for the printer. the whole report repaginates again based on the page size. Reader Aid: A soft (or logical) page break is a place in a document or text that automatically separates pages. where X is the number of the sheet in the workbook. Orientation is set to Portrait if the page width is less than the page height. Rendering in Word When the report is opened in Word. Page Naming If there is only one worksheet in the workbook. Additionally. the worksheets are named SheetX. excluding the Document Map. excluding the Document Map. Repagination can cause page breaks to be inserted in locations where you did not intend to add them. the name of the worksheet is the report name. otherwise. 4 . Page Sizing When the report is rendered. for example. as opposed to hard page breaks that are inserted manually by the user to separate pages. You can try to change Word's pagination by adjusting the page margins. Page Sizing The Excel rendering extension uses the page height and width settings to determine what paper setting to define in the Excel worksheet. and the top and bottom page margins.Reporting in Microsoft Dynamics® NAV 2013 Rendering in Excel This renderer supports only logical page breaks. Excel tries to match the PageHeight and PageWidth property settings to one of the most common paper sizes. left and right page margins. A new Excel worksheet tab is created for each explicitly defined logical page break. the fifth worksheet is then called Sheet5. the Word page height and width are set by the following RDL properties: paper size height and width. orientation is set to Landscape. If there are multiple worksheets in the workbook. If no matches are found. If the report is wider than 22 inches.Module 4: Design Considerations Page Width Word supports page widths that are up to 22 inches wide. The static size of the text box as defined in Visual Studio Report Designer will be used. you cannot use a complex expression to make a text box fit the widest or longest value. For the text box to decrease based on its contents. Useful Information This lesson describes several techniques that can be useful to create reports. If both properties are set to False. you can control the height of a text box using the CanGrow and CanShrink properties. The CanGrow and CanShrink properties indicate whether the size of a text box can increase or decrease vertically according to its content. In these views. Word will not display the report contents while in print layout view or reading layout view. to display the contents. It assumes that you are familiar with the content from the previous modules. the text box will not grow. Because both properties are not available in runtime. the report grows as wide as required. However. you can change the CanShrink property for the text box. the text box will expand vertically if the text box is not wide enough to show the value. However. The width must be defined by using a single expression in designtime and it will be respected in run-time. switch to normal view or web layout view. Word reduces the white space. CanGrow and CanShrink When you design reports. The minimum width of the report is based on the RDL Width property in the Properties pane. this does not apply to the height of a column. more of your report content is displayed. The width and height of a text box can be defined at design time by setting the Width and Height properties. If you set CanGrow to True. So. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . the renderer will still render the report. Although the Height property cannot be bound to a complex expression either. This is especially true if there are multiple columns and all the information must be available on one line. To view the data. When it is rendered. all other cells on the same row might expand vertically too (even if CanGrow for these text boxes is set to False). it can be a challenging when you design the column size.33 . If you set CanGrow to True for one text box in a table row. regardless of the length of its value. up to 22 inches. demonstration company. verify that the action is set to Create.Reporting in Microsoft Dynamics® NAV 2013 However. l. Import. In this demonstration text boxes are added to the body of a report that uses different colors and values for Cangrow and Canshrink. these two properties are useful to create the reports that can be scaled to both small and large contents. Select Tools.34 Add a text box that uses an empty value and CanShrink is set to TRUE. the CanGrow property indicates whether the size of the text box can increase vertically according to its content. Layout to open Visual Studio Report Designer. Open the CRONUS International Ltd. i. In the Object Designer. Click OK to start the import. Object Designer to open the Object Designer. Demonstration Steps 1. Select View. m. CanGrow and CanShrink behave differently for each rendering extension. g. f. Select File. k. For a text box. Click OK to import the object in the database. Demonstration: Using CanGrow and CanShrink in Different Rendering Extensions For a text box. Add a text box that uses a Value of "CanGrow" and CanGrow is set to TRUE. 4 . j. select to open the Import Worksheet window. In the Action column. The FontSize of each text box is linked to a variable that can be changed through the Request Page. d. In the dialog box. So. b.fob. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Add a text box that uses a Value of "CanShrink and CanGrow" and CanShrink and CanGrow are both set to TRUE. c. You can only dynamically control the height of the report elements through these properties because the Height property cannot be bound to an expression. Create a new report and add the following text boxes to the body of the report. The following step procedure shows the Cangrow and CanShrink behavior by using different values for the FontSize parameter. Browse to report R123456702. Add a text box that uses a Value of "CanShrink" and CanShrink is set to TRUE. h. n. e. the CanShrink property decreases the height of the text box according to its content. select the imported report and click Design. a. In the Report Dataset Designer. c.Hidden = TRUE). In the properties window verify that the property PrintOnlyIfDetail is set to No and if not. subtype Group and Caption Options. Add a third line with Type Field. g. verify that there’s a column that contains the FontSize field. h. Add a variable to the Request Page. o. set it to No. In the OptionString the value is 6pt. Exit Visual Studio.Module 4: Design Considerations 2. Add the variable FontSize to the request page. add a new line of type Column and set the Data Source and Name to FontSize.35 . Set the BackgroundColor for the first text box to Red. Type Request Page in the Caption property of the first line. SourceExpr FontSize and Caption FontSize. f. and then save and compile the report. Set the BackgroundColor for the third text box to LimeGreen. a. If not then. e. Open the Request Page. Set the BackgroundColor for the seventh text box to DarkViolet. p. In the Report Dataset Designer. Add a non-visible text box where CanShrink is set to TRUE. Then add a second line of type Group. Add a text box that uses a single space as value (Value = " ") and CanShrink is set to TRUE. e. Set the BackgroundColor for the fourth text box to SeaGreen.30pt. select the Integer data item. d. Set the BackgroundColor for the second text box to Orange. c. Set the BackGroundColor for each text box to a different color. there is a variable with the name FontSize of DataType Option.16pt. 3. a. i. q. below the integer data item. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . Add a non-visible text box (Visibility. f.10pt. g. Set the BackgroundColor for the fift text box to Aqua. b. import the RDLC report layout. b. In the C/AL Globals menu. d. k. j. h. Close the Request Page Designer. Set the BackgroundColor for the sixt text box to CornflowerBlue. a. add the variable FontSize into the FontSize property of each text box. b. Run the report. In the Value property use the following expression: ="FontSize=" & First(Fields!FontSize. In the report body. "DataSet_Result") 6.Reporting in Microsoft Dynamics® NAV 2013 4. 4 . In the first text box set the property FontSize to =First(Fields!FontSize.Value. The result will resemble this: FIGURE 4. Select View Layout to open Visual Studio Report Designer. "DataSet_Result") c. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Value. Run the report for FontSize 6pt. b. a. Add a new text box above the existing text boxes to display the selected FontSize. Add a new text box. b. a. c. In Visual Studio Report Designer. 5.36 Close the report.11: FONTSIZE 6PT WINDOW d. Select FontSize 6pt. select the text boxes and then move them down. c. Repeat this step for the other text boxes (2 to 7). c. Run the report for FontSize 16pt. Run the report.12: FONTSIZE 10PT WINDOW d. The result will resemble this: FIGURE 4. The result will resemble this: FIGURE 4. 8. Select FontSize 10pt. Run the report. Close the report.37 . b. Select FontSize 16pt. a. c. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . Run the report for FontSize 10pt. Close the report. b.Module 4: Design Considerations 7. a.13: FONTSIZE 16PT WINDOW d. c. Conclusion: 4 . The result will resemble this: FIGURE 4. Select FontSize 30pt.Reporting in Microsoft Dynamics® NAV 2013 9. Run the report.14: FONTSIZE 30PT WINDOW d. o When you increase or decrease the Width property of the textboxes results may vary from the presented screenshots. b. o Depending on the settings of CanGrow and CanShrink the textboxes will have a different size at runtime. Run the report for FontSize 30pt. a.38 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Close the report. a.16: FONTSIZE 10PT PDF WINDOW 12. a. Run the report for FontSize 6pt and export it to PDF.17: FONTSIZE 16PT PDF WINDOW Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . Run the report for FontSize 10pt and export it to PDF. Run the report for FontSize 16pt and export it to PDF.15: FONTSIZE 6PT PDF WINDOW 11. The result will resemble this: FIGURE 4. a.Module 4: Design Considerations 10. The result will resemble this: FIGURE 4. The result will resemble this: FIGURE 4.39 . The result will resemble this: FIGURE 4.40 o Similarly to the HTML rendering. because the layout might differ from what you see in Print Preview modus. empty space might appear between the textboxes.Reporting in Microsoft Dynamics® NAV 2013 13. a. o In the next steps we will export the report to Excel. o Depending on the Width of the textboxes and the selected Fontsize. Run the report for FontSize 30pt and export it to PDF. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . the CanGrow and CanShrink modify the heights of the text boxes.18: FONTSIZE 30PT PDF WINDOW Conclusion: 4 . This also depends on the amount of space there is in between the different textboxes. o It’s important to test the export of a report to PDF. 20: FONTSIZE 10PT EXCEL WINDOW Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . a. Run the report for FontSize 6pt and export it to Excel. The result will resemble this: FIGURE 4. Run the report for FontSize 10pt and export it to Excel. a. The result will resemble this: FIGURE 4.19: FONTSIZE 6PT EXCEL WINDOW 15.Module 4: Design Considerations 14.41 . Reporting in Microsoft Dynamics® NAV 2013 16. a. The result will resemble this: FIGURE 4.21: FONTSIZE 16PT EXCEL WINDOW 17. Run the report for FontSize 16pt and export it to Excel. The result will resemble this: FIGURE 4. Run the report for FontSize 30pt and export it to Excel.22: FONTSIZE 30PT EXCEL WINDOW 4 . a.42 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Module 4: Design Considerations Conclusion: o As you can see there might be differences in the PDF and Excel rendering.43 . In addition.Value & vbCrLf & Fields!Customer_Address. for example here: FIGURE 4." "Yes/No.23: FONTSIZE 10PT WORD WINDOW o When the text box shrinks. You can also simulate the check box control in reports. o The Word rendering extention might also render CanGrow and CanShrink differently." even work with "1/0" or any other combination. You can use "True/False. Visual Studio Report Designer does not include a separate check box control. you can set the Value property of the text box to an expression similar to the following: Code Example =IIF(Fields!Customer__Print_Statements_. you can change the font of the text box to Wingdings. you can use the vbCrLf constant: Code Example = Fields!Customer_Name. white space might appear in between the text boxes. Chr(0254). Check Boxes Boolean fields can be displayed in multiple ways. or multilanguage enabled presentation.Value & vbCrLf & Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . "o") New Lines To include line breaks in an expression. For a field to be displayed as a check box. You can either use the required data value of the field or work with expressions to translate the intrinsic value to a different and.Value = "1". In the previous expression. only the last one will be ignored.) 4 . If the line break is the last character in a text box.44 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Value & vbCrLf & Fields!Customer__Country_Region_Code_. (If you have multiple line breaks.Value You can use this to format text as a block in a text box. the address fields will be formatted as a block inside a text box.Reporting in Microsoft Dynamics® NAV 2013 Fields!Customer__Post_Code_.Value & space(2) & Fields!Customer_City. it will be ignored. To keep multiple objects together on a page. put them inside a rectangle and define the Visibility for the rectangle. If you have multiple controls that must be hidden together. Now. Using Rectangles to Control Item Growth and Displacement or Visibility Items in a rectangle become peers of one another and are governed by the rules of how peer items are positioned on the page as they move or grow. As object containers. When the table grows. • If you want to prevent a matrix from pushing items off the right side edge of the page.Module 4: Design Considerations Other Visual Basic (VB) constants such as vbTab are not supported inside a text box. the matrix is no longer a peer to the other item on the page and cannot push it until the matrix can no longer be contained within its rectangle. group the blank space and the table in the same rectangle. they keep objects together on a page and control how objects move and push one another. You can use this logic to your advantage when you deal with objects that expand. • Items will not push or displace items outside the rectangle. The following code sample shows or hides the rectangle (and all controls inside the rectangle) based on the value of a Boolean variable (HideRectangle) on the request options page: Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . put the matrix in a rectangle with blank space to its right. For example: • If you want to leave a blank space in your report for a table to expand into.45 . You can then put a page break before or after the rectangle by using the PageBreakAtStart or PageBreakAtEnd properties for the rectangle. Use Rectangles to Keep Objects Together Rectangles can be used either as graphical elements or as containers of objects. a rectangle will grow to accommodate the items it contains. it will push the blank space. For example: • Items will push or displace one another in the rectangle. you can use the Space() function. put the objects in a rectangle. because they are not their peers. To insert several spaces. • If it is necessary. 23: THE REPORT PROPERTIES WINDOW WITH THE DEFAULT PAGE SIZE AND MARGINS 4 . In the Report Properties window. True. Report Properties in Visual Studio Report Designer. To change the Parent property. The property cannot be edited directly in the Properties window. 1. FIGURE 4. this happens when the size of the report body exceeds the size of the page. blank pages will be visible when outputting reports to a physical page format such as PDF or print. Select Report. Generally. Avoid Blank Pages Sometimes. check the control's Parent property. 2. drag the control to another location. Default value for all controls is the section that they are included in.46 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . False) To see whether a control is positioned inside a rectangle control. For rendering formats that render physical pages (such as PDF).Value = True). click the Page Setup tab. you can set the page height and page width properties for the report to control the pagination.Reporting in Microsoft Dynamics® NAV 2013 Code Example =IIF(First(Fields!HideRectangle. lists.47 . if you have a large report. You must understand that controls on the page that do not seem to contain any information (a wide text box) can cause a blank page to be added to the report (when printed or viewed in Print Layout mode) if the control exceeds the page boundaries. groups. if any objects grow as they are filled with data. To make sure that all the contents fit on a single page. Use Page Breaks to Improve Performance for Large Reports If you do not specify a page size or page breaks for a report that returns a large amount of data. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . Therefore. For these reports. because they can view the first page while the rest of the report is being rendered. The design time size of the body represents the smallest amount of space that will be used by the report. Typical examples are matrix data region controls and images set to automatically Autosize or Fit. some report formats will try to render the report as a single page. However. You must understand that setting the Body size at design time is not generally useful in controlling pagination. a physical page break occurs. The body is the container for the collection of objects on the report. The page size and margins are mapped into the Excel document for printing within Excel. if they are defined) exceeds the specified page size (minus the margins). data regions). the body width plus the margins must be less than the defined page width. some report items can grow horizontally and can cause the width of the body to exceed the page width. the body will grow taller (tables. Mostly. The Excel rendering format does not explicitly support pagination. For example. Page breaks can also be specified explicitly before or after instances of report items (rectangles. the body will expand to contain them. However. by using page breaks this improves the performance for the users who are accessing the report. Excel has no default notion of a fixed page size. Generally. you will have to specifically include page breaks to break the report into multiple worksheets. and text boxes are some items that will cause vertical growth) but can also grow wider (matrices and autosized images can cause horizontal growth).Module 4: Design Considerations Here you can define the page height and page width together with the different report margins. Excel will try to render it as a single worksheet. When the runtime size of the body (plus the page header and footer size. Then in the group properties.48 • Page size • Page breaks specifically included before or after objects Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . to add a page break after every 30 rows. use the Iif() function to assign the background color conditionally. Page breaks are controlled by two factors: 4 . you can make the alternating bars green."White") Pagination One key design issue for long reports is controlling where the page breaks occur. The Ceiling function returns the smallest number that is greater than the argument. For example: Code Example =IIF(RowNumber(Nothing) Mod 2.Reporting in Microsoft Dynamics® NAV 2013 Insert a Page Break Following a Specific Number of Rows in a Table You can use the Ceiling function to group the rows in a table and insert a page break at the end of each group. Add Alternating Bars to a Table You can create a report that contains a table or matrix in which every other row is shaded. you can use the following expression to group the rows: Code Example =Ceiling(RowNumber(Nothing)/30) To do this."PaleGreen". based on whether the row number is odd or even. enable the property to add a page break after each instance of the group. To more closely simulate the old “green bar” paper that were used at one time to run large reports on high-volume data center printers. To achieve this effect. For example. add a group in the tablix and use this expression as the GroupExpression. This bar effect makes it easier to visually track the different rows across a page. then the report will break across multiple pages horizontally. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . set the page height and width properties for the report by using the following guidelines: • For rendering formats that render physical pages (PDF). list.49 . Report Viewer tries to keep all the data in the item or grouped on the same page.Module 4: Design Considerations Page Size To control page size. To include page breaks specifically before or after items. such as Excel. it is necessary to specifically include page breaks to break the report into multiple pages. • Some rendering formats. use the PageHeight and PageWidth properties for the report. Page Breaks You can apply page breaks at the beginning or end of a rectangle. do not support page size. If the report is wider than the defined page width. use the PageBreakAtEnd and PageBreakAtStart properties for the item. or group. matrix. For these reports. table. chart. Reporting in Microsoft Dynamics® NAV 2013 Setup Multiple Columns You can use the Report Designer to easily create multicolumn reports. define a multicolumn layout by region. Currently. On the Page Setup tab.24: EXAMPLE OF A MULTICOLUMN REPORT To create this kind of multicolumn report. FIGURE 4. If you preview the report. a table region. 4 . you must make sure that the report data width does not exceed the column width. make sure that you preview the report by clicking the Print Layout button. select Report. the page size and the margins. You cannot. A multicolumn report can conserve space by displaying the report data in more than one column. To view the report rendered correctly in multiple columns. for example. Report Properties from the menu. To define the number of columns. you cannot view the data that flows in columns because the preview mode does not consider the page settings.50 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . for example. Report Viewer supports defining multiple columns only at the report level. you can specify the number of columns. you can easily determine whether the report width exceeds the page width. The Usage of Colors In this module several techniques show how to apply colors to a report so that you can visualize information more clearly. Remember to consider the following when you design and implement report items so that they can be used by every report user in the company. Then.Module 4: Design Considerations When you set up the column widths. • In Line charts. • Shapes are as important as colors. use markers with different shapes.1) * column spacing Report Designer eliminates the trial-and-error fitting game and shows you the outline of the columns in layout mode. An example is the usage of alternating colors in a tablix data region. A part of the report users might be unable to correctly interpret are some graphs and charts. Using alternating colors increases the readability of the report. • Greyscale and shades of the same color might be more readable for a person who has a color vision deficiency. However a certain percentage of people could have problems distinguishing colors. include a marker on the top of each bar. • In bar graphs. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . by using the following formula: Page width-(left margin + right margin) >= number of columns * column width + (number of columns .51 . Being unable to clearly distinguish colors makes charts and tables confusing to understand. A way to test the readability of a report that contains colors is to print the report in black-and-white and then determine whether all the information is well presented. • Images that are used as key performance indicators must be different in shape rather than just color. you must make sure that there is sufficient page space to accommodate the number of columns. Instead of having the item number and item name displayed on an orange background. Import the object in the demonstration database. demonstration company. Detailed Steps 1. b. Click OK to import the object in the database. Click OK to start the import. The rows must have alternating backgrounds colors. In the Action column. Browse to the report R123456701. g. a. h. select to open the Import Worksheet window. d. Select Tools. e. verify that the action is set to Create.1: Creating Green Bar Reports Scenario Ellen asks Mort to improve the readability of the Inventory report. use a function that returns either "LightSteelBlue" or "White" every time that a new item number is printed. Select File. She also prefers a lighter pastel background color (LightSteelBlue). Open the Microsoft Dynamics NAV 2013 demonstration database. Objectives In this lab. c. f. Task 1: Import Report 123456701 High Level Steps 1. Import the object in the demonstration database. In the dialog box. Open the CRONUS International Ltd. Object Designer to open the Object Designer. she wants to have the inventory amounts printed with alternating background colors. Exercise 1: Implement a Green Bar Effect Exercise Scenario Create a green bar matrix report that shows the item inventory by location.Reporting in Microsoft Dynamics® NAV 2013 Lab 4. To select the correct colors.fob.2 (Creating a Matrix Report) by adding the green bar functionality. Import. 4 . you will fine-tune the report that you created in Lab 1.52 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Add a custom function to the report. Task 3: Change the Background Color for the Row Header Cells High Level Steps 1.AlternateColor("LightSteelBlue". Repeat this step for the textbox on the second row. if not already present in the report and review the code: Code Example Private bOddRow As Boolean Public Function AlternateColor(ByVal OddColor As String. b. b. Change the Value of the BackgroundColor property to the following expression: =Code. c. On the Code tab. True) d. first column. Detailed Steps 1. "White". ByVal EvenColor as String. Detailed Steps 1. ByVal Toggle As Boolean) As String If Toggle Then bOddRow = Not bOddRow End If If bOddRow Then Return OddColor Else Return EvenColor End If End Function d. Change the background color for the cells in the first column. select the BackgroundColor property. a. Change the background color for the cells in the first column. Select the first cell on the first table row (the cell that contains the Item No. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . Select Report.53 . In the Properties window. Click OK to close the Report Properties window.Module 4: Design Considerations Task 2: Add a Custom Function to the Report High Level Steps 1. Open report 123456701 in Visual Studio. c. add the following custom variable and function. Report Properties. a. and Description fields). Add a custom function to the report. Reporting in Microsoft Dynamics® NAV 2013 e. In the properties window. Detailed Steps 1. f. False) 4 . at the right bottom of the Tablix.Value b. save the object and run it. Change the background color for the other row cells. "LightSteelBlue".AlternateColor("White". In the Properties window. Select the second cell on the second table row (the cell that contains the Inventory field (textbox Item_Ledger_Entry_Quantity). a.54 d. select the BackgroundColor property. Set the BackgroundColor property to of Rectangle1 to No Color Task 4: Change the Background Color for the Other Row Cells High Level Steps 1. Change the Value of the BackgroundColor property to the following expression: =Code. select textbox Color. Change the background color for the other row cells. c. import the new RDLC layout in the object. This textbox has the following expression for its value: =Fields!Item_Ledger_Entry_Quantity. Select Rectangle1 in the Properties window. e. Set the Width property to 0cm. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . f. Exit Visual Studio. 55 .25: GREEN BAR REPORT PREVIEW Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 .Module 4: Design Considerations The result will resemble this: FIGURE 4. Objectives In this lab. Exercise 1: Implement a Top X Dashboard Exercise Scenario Make a copy of report 1106. Import.Reporting in Microsoft Dynamics® NAV 2013 Lab 4. a. Finally. Open the CRONUS International Ltd.Chart. Prakash wants to have the existing report content replaced by two charts. After he creates a copy of the original report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . because it is sorted by resource number and sorting cannot be changed. The first chart must show the three most used resources. Import the object in the demonstration database.2: Creating a Top X Report Scenario Prakash is searching for available resources for one of his projects and he wants to check the resource usage. b.Utilization and save it as report 123456706. you will add Top X functionality to report 123456706. Instead. Object Designer to open the Object Designer. Detailed Steps 1. The current report 1106.Utilization Chart. Add a "Show Details" text box that you can use to toggle the visibility of the current report content (the table control). Open the Microsoft Dynamics NAV 2013 demonstration database. he asks Mort not to delete the current report content. Resource Utilization . Task 1: Import Report 123456706 High Level Steps 1. Extend report 123456706 so a Top 3 chart for the three most used and a Top 5 chart for the least used resources show at the same time. 4 . The second chart must show the five least used resources. demonstration company. does not immediately provide this information. c. Resource . Select File. d. Mort starts to develop the report. Resource . he proposes to hide the content.56 Import the object in the demonstration database. Resource -Utilization. Select Tools. The table must be displayed under the charts. and include a button or a label that can be clicked to show or hide the details dynamically. f. Select the body.57 . Reorganize the body section. Browse to the report R123456706. In the Properties window. Position it immediately under the Resource_TABLECAPTION__________ResFilter text box. b. j. Click OK in the Imported Objects window. e. set the Name property to ShowDetails. a. Click OK to start the import. b. In the dialog box. Open report 123456706 in Visual Studio Report Designer.10001cm. Select the newly added text box. Reorganize the body section. Task 4: Format the Show Details Text Box High Level Steps 1. Click the body to insert a text box control. In the Toolbox window. select to open the Import Worksheet window. a. Change the height of the body section to 9. Detailed Steps 1. Format the Show Details text box. Click OK to import the object in the database. In the Action column. i. verify that the action is set to Create. c.fob. Move it to the bottom of the body section. Detailed Steps 1. d. Move the newly added text box control to the left of the body section. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . select the Textbox control. g. Select the Table1 Tablix control. Task 3: Include a "Show Details" Text Box to Show/Hide the Table High Level Steps 1. c.Module 4: Design Considerations e. Add a "Show Details" text box to Show/Hide the Table. Task 2: Reorganize the Body Section High Level Steps 1. Detailed Steps 1. b. Format the Show Details text box. h. Add a "Show Details" text box to Show/Hide the Table. a. Hide the report content. Task 6: Add a Top 3 Chart for the Most Used Resources High Level Steps 1. select the Resource__No__ element. f. c.446cm. Detailed Steps 1. change the Left property to 0 cm. 4 .58 Add data elements to the Chart. set the ToggleItem property to ShowDetails. c. b. Hide the report content. In the Properties window. e. In the Properties window. In the Properties window. Add a chart to the report. d. d. In the Properties window. Task 7: Add Data Elements to the Chart Control High Level Steps 1. a. In the Properties window. e. change the Top property to 1. set the FontWeight property to Bold. set the BackgroundColor property to LightGrey. In the Properties window. In the Properties window.Reporting in Microsoft Dynamics® NAV 2013 c. b. c. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Add data elements to the Chart. In the Toolbox window. Task 5: Hide the Current Report Content High Level Steps 1. a. g. Select View. Click the body to insert the Chart control. set the TextAlign property to Center. set the Color property to Black. In the Properties window. set the Value property to Show Details. Add a chart to the report. Report Data to open the Report Data window. a. Detailed Steps 1. In the Chart Type field. b. select the Table1 Tablix control. In the Report Data window. Detailed Steps 1. In the body. In the Properties window. select the Chart control. set the Hidden property to True. select Stacked Column and then click the OK button. Double-click the chart control. h. select Add to add a filter. p. Format the Top 3 chart. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . Drag it to the Drop Data Fields Here area. In the Report Data window. Click the OK button to close the Category Group Properties window. k. s. select Excel. right-click and select Legend Properties. On the Chart. f. in the Title field. select Z to A. e. o. select the Resource__Usage__Qty___ element. In the Value column. select [Resource__Usage__Qty___]. select Add to add a filter. Double-click the Chart and in the Drop Category field here. b. select Hide. In the Palette property of the chart. d. Click the OK button to close the ChartTitle Collection Editor window. On the Filters tab . On the Sorting tab. Select the option Category Group Properties. Format the Top 3 chart. On the Vertical Axis. q. In the Caption field enter the following text: Top 3 . Task 8: Format the Top 3 Chart High Level Steps 1. l.59 . g. On the Horizontal Axis. m. select Top N. in the Title field.Module 4: Design Considerations d. enter Usage (Qty). Click OK to close the Legend Properties window. right-click the Resource__No__ field. i. In the Visibility tab. Select [Resource__Usage__Qty___]in the Expression field. On the Sorting tab . in the Sort by column. a. In the Operator column. Open the Titles property collection in the Properties window. In the Direction column. enter =3. Drag it to the Drop Category Fields Here area. j. e. r. enter Resource. Select the chart control and select Chart Properties.Resource Utilization. t. n. f. Detailed Steps 1. c. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Double-click the chart control. e. Task 10: Add Data Elements to the Chart Control High Level Steps 1. Detailed Steps 1. b.5cm. Click the body to insert the Chart control. Add the fields Resource__No__ and Resource__Usage__Qty___ to the chart. change the Left property to 7. In the Caption field enter the following text: Bottom 5 Resource Utilization. Add a top 5 chart for resources that are used the least. a. Open the Titles property collection in the Properties window. Detailed Steps 1. In the Website Data Sources window. Drag it to the Drop Category Fields Here area. select the Chart control. Add a top 5 chart for resources that are used the least.60 Apply formatting to the chart. select Stacked Column and then click the OK button. e. In the Properties window. d. c. d. b. Detailed Steps 1. In the Toolbox window. a. In the Properties window. change the Top property to 1. a.446cm. Select the chart control and select Chart Properties. select the Resource__Usage__Qty___ element. Click the OK button to close the ChartTitle Collection Editor window. Apply formatting to the chart. In the Chart Type field. c. Add the fields Resource__No__ and Resource__Usage__Qty___ to the chart. c.Reporting in Microsoft Dynamics® NAV 2013 Task 9: Add a Top 5 Chart for the Least Used Resources High Level Steps 1. b. d. 4 . In the Website Data Sources window. select the Resource__No__ element. Drag it to the Drop Data Fields Here area. Task 11: Format the Top 5 Chart High Level Steps 1. j. Click OK to close the Legend Properties window. Click the OK button to close the Category Group Properties window. In the Operator column. b. On the Sorting tab. Click Run. Save and import the RDLC changes. f. select Add to add a filter. In the Visibility tab. On the Horizontal Axis. c. Double-click the Chart and in the Drop Category field here.Module 4: Design Considerations e. Save and run the report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . Select the option Category Group Properties. Task 12: Run the Report High Level Steps 1. On the Filters tab . in the Title field. s. k. h. in the Title field. a. select Hide. select [Resource__Usage__Qty___] in the Expression field. g. On the Sorting tab. Save and compile the report in the Report Designer. n. enter =5. d. enter Usage (Qty). Exit Visual Studio. o. Detailed Steps 1. Save and run the report. select [Resource__Usage__Qty___]. On the Chart. in the Sort by column. select Add. l.61 . In the Palette property of the chart. enter Resource. right-click the Resource__No__ field. i. select Bottom N. right-click and select Legend Properties. r. m. select Excel. p. On the Vertical Axis. In the Value column. q. On the Filters tab. the report resembles this: FIGURE 4.62 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Reporting in Microsoft Dynamics® NAV 2013 After you click the Show Details button.26: TOP X REPORT PREVIEW 4 . • How to create a dashboard report. What happens when a report that uses a chart is exported to Excel? ( ) The chart is converted to an Excel chart. • Simulate transheader and transfooter sections. What happens when a report is exported with a multilevel document map to PDF? ( ) The document map is not exported. 1. ( ) The chart is converted to an image.63 . 2. ( ) The document map is exported but the hierarchy is lost and all items appear on the same level in the Bookmarks pane. ( ) An error message is displayed because you cannot export reports that use multilevel document maps. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 . • Using a Chart in a report. Test Your Knowledge Test your knowledge with the following questions. ( ) An error message is displayed because you cannot export reports that use charts. ( ) The chart is converted to a table. ( ) The document map is exported without changes to the Bookmarks pane. Furthermore the module contains useful considerations about report rendering and pagination and interesting tips and tricks in advanced report design.Module 4: Design Considerations Module Review Module Review and Takeaways This module demonstrated how to implement some of the most used report patterns and recipes: • How to apply a green bar effect. Which C/AL function for exporting reports is now added in Microsoft Dynamics NAV 2013? ( ) SAVEASHTML ( ) SAVEASPDF ( ) SAVEASWORD ( ) SAVEASEXCEL 4. Which operator is used to filter a recordset to the three highest values? ( ) Max(3) ( ) Max N ( ) Top 3 ( ) Top N 5.Reporting in Microsoft Dynamics® NAV 2013 3. Which operator is used to filter a recordset to the three lowest values? ( ) !Top N ( ) -Top N ( ) Bottom N ( ) <> Top N 4 .64 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . ( ) The chart is converted to a table.65 . ( ) The document map is exported without changes to the Bookmarks pane. 3. Which C/AL function for exporting reports is now added in Microsoft Dynamics NAV 2013? ( ) SAVEASHTML ( ) SAVEASPDF (√) SAVEASWORD ( ) SAVEASEXCEL 4. 2. ( ) An error message is displayed because you cannot export reports that use multilevel document maps. What happens when a report that uses a chart is exported to Excel? ( ) The chart is converted to an Excel chart. ( ) An error message is displayed because you cannot export reports that use charts. (√) The document map is exported but the hierarchy is lost and all items appear on the same level in the Bookmarks pane. Which operator is used to filter a recordset to the three highest values? ( ) Max(3) ( ) Max N ( ) Top 3 (√) Top N Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 4 .Module 4: Design Considerations Test Your Knowledge Solutions Module Review and Takeaways 1. (√) The chart is converted to an image. What happens when a report is exported with a multilevel document map to PDF ( ) The document map is not exported. 66 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Reporting in Microsoft Dynamics® NAV 2013 5. Which operator is used to filter a recordset to the three lowest values? ( ) !Top N ( ) -Top N (√) Bottom N ( ) <> Top N 4 . • Describe how to run a report from the RoleTailored client. or they can be called from an action on a page. when you design reports. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5-1 . • Describe how to create a hyperlink to a page. In the earlier modules. • Examine how to create and run hyperlinks to reports at the command prompt. you might want to run them before they are integrated into the application. Objectives The objectives are: • Use the features of the ReportViewer control. • Examine how to add a report to a page and the Departments section. reports can be incorporated into menus. • Describe how to run a report from a SharePoint site. • Describe how to create a hyperlink to a report. • Run a stand-alone report by using Visual Studio. This module will show how to integrate the reports into the RoleTailored client interface and how to create hyperlinks to reports. • Review where to locate additional resources and information about reporting. Sometimes. the Desktop and Microsoft Internet Explorer. the Start menu. you used the object designer to run reports.MODULE 5: RUNNING REPORTS Module Overview In Microsoft Dynamics® NAV 2013. the ReportViewer control is used as a viewer to display a predefined report that is already published on a Reporting Services report server. In remote processing mode. The ReportViewer Windows Forms control is used to host reports in Microsoft Windows application projects. aggregated. • Remote processing mode refers to report processing that is performed by a Microsoft SQL Server Reporting Services report server.Reporting in Microsoft Dynamics® NAV 2013 The ReportViewer Control Microsoft Visual Studio 2010 includes report design functionality and ReportViewer controls so that you can add full-featured reports to custom applications. The ReportViewer control processes .rdlc files.1: THE REPORTVIEWER TOOLBAR 5-2 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .NET projects. All processing from data retrieval to report rendering is performed on the report server. search. FIGURE 5. How you configure the processing mode affects everything about the report from design to deployment. ReportViewer Toolbar The ReportViewer control includes a toolbar that provides navigation. There are two versions of the control. and print functionality so that you can work with reports in a deployed application. and multidimensional data. All report processing is performed as a local process by using data that your application provides. export. Reports can contain tabular. ReportViewer controls are provided so that you can process and display the report in your application. • Local processing mode refers to report processing that is performed by the ReportViewer control in the client application. The Report Viewer control is part of the Report Preview Page. Both controls can be configured to run in local processing mode or remote processing mode. The ReportViewer web server control is used to host reports in ASP. However.PREVIEW is used. the ReportViewer toolbar is updated to show just the commands that you can use during preview. Print Layout is a toggle command. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5-3 . Note: Note that if in the code of the report the function CurrReport. Not all reports have a document map. Stopping a Report You can use the Stop button to stop report rendering. Only visible content is included in a search operation. When you click Page Size. To search for the next occurrence of the same value. The page dimensions are initialized with values from the report definition. If the reports uses show / hide functionality. click Next. you can specify page dimensions that are used only for print output. You cannot save the values with the report. you can override the values when you print. When you click Print Layout. refer to the “Interactive Features” module. Zooming the Report Page The ReportViewer toolbar provides standard zoom functionality so that you can increase or decrease the report. You must define one in the report definition to use this feature.Module 5: Running Reports Document Maps A document map is a navigation area that is attached to the left side of the report view area. The search is case-insensitive and begins at the page or section that is selected. You can search for content in the report by typing a word or phrase that you want to find. Previewing a Report and Setting Page Sizes The ReportViewer toolbar includes commands for viewing a report in print layout and setting page sizes. The Stop button can be used to stop a report when you test reports or when a report has slow performance. hidden content is not exposed through search operations. then the print button will not be available in preview mode. It includes a list of links that users can click to browse to a specific area of the report. Searching a Report The ReportViewer toolbar includes a search field so that you can find specific text in a report. Wildcard characters and Boolean search operators are not supported. You can switch between preview and print layout by clicking this button. For more information about document maps and other interactive report features. • Properties dialog box for the printer. The printer that you use determines what to do if the actual paper size in the printer differs from the page size that is specified. Word) Printing a Report The ReportViewer toolbar provides print support. The same report can have a different appearance and functionality. Print. • Print a report from the Print Preview page. Excel. 5-4 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . refer to the “Design Considerations” module in the section about pagination. Best Practice: It’s strongly encouraged to test the development with all render extension (Preview. • Page Setup dialog box from the Print Preview page in the Reportviewer.Reporting in Microsoft Dynamics® NAV 2013 Exporting a Report The ReportViewer toolbar provides export formats so that you can save a report as an Excel. You can specify page settings and page orientation for a printed report from the following user interface (UI) locations: • Report Properties dialog box on the client report definition (RDLC) report layout in Visual Studio. Reports that have links. depending on the rendering format that you select. For more information. and does not display a request page. document maps. • Print dialog box that is displayed immediately before you print. You can use the following modes to print a report: • Run a report that has the UseRequestPage Property set to No. the report layout in a different file format might include additional pages or white space that you did not expect. Depending on how items are aligned in a report. PDF. The page settings that are used for the printed report depend on the mode in which you print the report. and bookmarks might not function correctly after the report is saved to a file. • Print dialog box from the Print Preview page in the Microsoft Dynamics NAV Portal Framework for Microsoft SharePoint 2010. • Print a report from the request page without previewing the report. PDF or Word program file. 6. 11. There are several ways to add reports. 5. Adding Reports to a Page The following procedure explains how to make a report available in the application by adding the report to the Action Pane in the Item List page. and then set the PromotedCategory property to Report. you can add the report to the interface of the application to make it available to the end-users.Module 5: Running Reports Run a Report in Microsoft Dynamics NAV After a report is created and designed by using Visual Studio. set the Promoted property to Yes. 10. In the Microsoft Dynamics NAV development environment. In the Properties window. 13. 12. • In the Role Center menu. Item List. On the new line. In the Caption field. These include the following: • In the Action Pane of a page. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5-5 . 1. add an action to the list. • In the Activities page of a Role Center or in the Departments section. New). Click View. and then Properties to open the Properties window for the new action. enter a name for the action: Inventory Matrix. Press F3 to insert a new empty line (or select Edit. click the drop-down arrow and select report 123456701 in the Object List window. Select the page to display the report. and then Actions to open Action Designer. 3. select Action. open Object Designer. 4.List as its caption. In the Value field of the RunObject property. for example. 7. Click View. Scroll down to the ActionContainer that has Reports as its subtype. Select the line that has Inventory . and then click Page. Click Design to open the page in Page Designer. 2. Page 31. In the Type field. 9. Select an empty line in the designer. 8. Click the Separator button to insert a separator. Adding Reports to a Role Center Menu Ellen wants the Inventory Matrix report to be available for her colleague John. 3. Select an empty line in the designer. open Object Designer. 4. Press F3 to insert a new empty line (or select Edit. 5-6 1. Mort will add it to the menu of John's Role Center.Reporting in Microsoft Dynamics® NAV 2013 14. 2. Scroll down to the Action that has Customer Labels as its Caption. 15. Move the pointer one line down.2: THE NEW REPORT IS ADDED TO A PAGE. 8. Click View. In the Microsoft Dynamics NAV development environment. New). FIGURE 5. 7. Select page 9009. The report is added to the list of promoted actions. Compile and save the page. The report is also available in the Reports menu that appears over the Action Pane. Click the action to run the report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . and then Page Actions to open Action Designer. Click Design to open the page in Page Designer. 6. Open Dynamics NAV 2013 and then open the Item List page. 5. Whse. Click the Page button. Worker WMS Role Center. 9. Click View. click the Role Center page. 15. 1. in the Caption field. In the Value field of the RunObject property. 2. Compile and save the page. In the Type field. To help John.3: THE NEW REPORT IS ADDED TO THE ROLE CENTER MENU Now the report is added to the Role Center menu. On the new line. Adding Reports to the Role Center Activities John is not that experienced with computers. Mort will make the report accessible as a link on the Role Center page. In the navigation pane. He regularly calls Mort to ask where he can find the Inventory Matrix report. Click the Page button. 14. and then Properties to open the Properties window for the new action. click the drop-down arrow and select report 123456701 in the Object List window. select Action. Open the RoleTailored client. Click the action to run the report. 11. In the Microsoft Dynamics NAV development environment. enter a name for the action: Inventory Matrix. open Object Designer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5-7 . 12. 16. 13. FIGURE 5.Module 5: Running Reports 10. in the Caption field. 5-8 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Click Design to open the page in Page Designer. 10. In the Type field. Control Actions. select Action. 4. 12.Reporting in Microsoft Dynamics® NAV 2013 3. and then Properties to open the Properties window for the new action. Click View. 6. Click the action to run the report. Compile and save the page. Open the RoleTailored client and then open the Role Center page. On the first empty line. enter a name for the action: Print Inventory Matrix. 11.4: THE NEW REPORT IS ADDED TO THE ACTIVITIES PAGE Now the report is added to the Internal group in the Role Center page. 9. 8. 7. FIGURE 5. Select page 9056. click the drop-down arrow and select report 123456701 in the Object List window. 5. Select View. Scroll down to the Group that has Internal as its Caption. In the Value field of the RunObject property. Warehouse Worker Activities. The Departments item in the navigation pane provides links to all pages. depending on the MenuSuite level. such as pages and reports. MenuSuite objects contain the main menu content that is displayed in the in the Departments page and have a layered structure. The navigation pane is made of MenuSuite objects.MBS Add-on 1 1051 Dept . The Departments page provides access to reports and pages and it is built by using MenuSuite objects. the ID of the MenuSuite is defined by the development environment. navigation through the application is performed by using the navigation pane. In Dynamics NAV 2013. Unlike any other application objects.Module 5: Running Reports Adding Reports to a Departments Section In Microsoft Dynamics NAV 2013.Company Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5-9 . Level MenuSuite Object MBS 1010 Dept . The links and pages under Departments are generated automatically based on the menu suite of the RoleTailored client user. The ID of a MenuSuite is shown in the following table. application objects.Add-on 1 Company 1090 Dept . are accessed from either the Departments page or the Role Center page. FIGURE 5. When you create a new MenuSuite object. When you add menu items to a MenuSuite. you can design the existing or create new MenuSuite objects. a property Department page is available. There are six categories: 5 .5: THE GROUP PROPERTIES WINDOW When you create menu groups in the MenuSuite.Reporting in Microsoft Dynamics® NAV 2013 To modify the navigation pane or the Departments page.10 • Lists • Tasks Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . you have to select the menu level. you must specify the Department category to which the menu item belongs. Open the RoleTailored client and then open the Departments page. select Report.11 . 2. In the Object ID field. 3. In the Microsoft Dynamics NAV development environment. 1. open Object Designer. he asks Mort to integrate the report in the Job menu on the departments section. In the Department Category field. 11. Compile and save the MenuSuite.Partner level. select the Dept . 12. 6. Click the MenuSuite button. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . Click OK to close the Create Item window. In the Object Type field. Click the New button to open the Design Level window. Click the Jobs item. 4. Adding Reports to a Departments Section Prakash wants to print the Job Actual To Budget Chart report (123456709). Expand the Reports menu group and select the last report in the group: Jobs per Item. 9. 13. In the navigation pane designer. 7. click the drop-down arrow and select report 123456709 in the Object List window. 8. In the list. Mort will first create a new MenuSuite object. select Reports and Analysis. 14. select the Jobs menu. 5. Instead of printing it by using the Start menu. In the Caption field.Module 5: Running Reports • Reports and Analysis • Documents • History • Administration The Department property is used to automatically generate the navigation structure. Right-click the menu item and select Create Item. 15. 10. change the caption to Job Actual to Budget Chart. Reporting in Microsoft Dynamics® NAV 2013 Now the new report is added to the Reports and Analysis category. you can create a hyperlink to a specific list page. type the Microsoft Dynamics NAV Client Executable and Protocol handler and then type the syntax for the hyperlink.12 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . For example: Code Example Microsoft. company. such as Customers. FIGURE 5.exe "DynamicsNAV://MyServer/DynamicsNAV70/CRONUS International Ltd. it opens the RoleTailored client and runs page 22.Dynamics./RunPage?Page=22" This example specifies a server name. If it is entered correctly. service.Client. For example.7: REPORT ADDED TO THE DEPARTMENTS SECTION Hyperlinks to Reports You can use hyperlinks to send or save quick links to specific pages in Microsoft Dynamics NAV. Create Hyperlinks To create a hyperlink. This lesson explains how to create and run hyperlinks to reports. the Customer List page. and page ID.Nav. 5 . the default values are assumed. an XMLport. service. If you omit two parameters. and company. a codeunit. you must leave the correct number of forward slashes to indicate the parameters that you have omitted.13 . a query. then they must be company and instance. service. If you omit just one of these parameters. Code Example DynamicsNAV://MyServer///RunPage?Page=22 You can also specify a server port: Code Example DynamicsNAV://MyServer:1234///RunPage?Page=22 This URL omits server. Therefore. a report. if you do this. and company: Code Example DynamicsNAV://///navigate?node=Home/Items Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . then it must be company. For example. However. or a node: • DynamicsNAV://server/instance/company/runpage?page=22&bookm ark=0ABA0700235752C7D1 • DynamicsNAV:// server/instance/company/runreport?report=901 • DynamicsNAV:// server/instance/company/runquery?query=50000 • DynamicsNAV:// server/instance/company/runxmlport?xmlport=99008500 • DynamicsNAV:// server/instance/company/runcodeunit?codeunit=50000 • DynamicsNAV:// server/instance/company/navigate?node=Home/Items The first three parameters to a client URL are reserved for server. You can also omit all three parameters. You can omit certain parameters.Module 5: Running Reports Building a URL When you build a hyperlink URL. the following URL assumes the default instance and company on the MyServer server. you can specify a page. If a personalization ID is not found. Example: DynamicsNAV://localhost/DynamicsNAV70/CRONUS %20International%20Ltd. Other modes include view. you will receive an error message.Reporting in Microsoft Dynamics® NAV 2013 You can also specify the following additional parameters in a URL. create. If an incorrect bookmark is entered./runpage?page=22&pers onalization=0000232e-0000-001a-00080000836bd2d2 Bookmark Positions the pointer on a single record in a table./runpage?page=22&mode =View 5 . Example: DynamicsNAV://localhost/DynamicsNAV70/CRONUS %20International%20Ltd. Parameter Personalization ID Description Specifies the unique identification used in personalization to store settings in the User Metadata table. the page is started without personalization. Example: DynamicsNAV://localhost/DynamicsNAV70/CRONUS %20International%20Ltd./runpage?page=22&book mark=120000000089083237343 Mode Used to open a page in a specific mode. Only automatically generated bookmarks are used. and delete.14 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . edit. select. Dynamics. DynamicsNAV:////ru npage?page=<page id> DynamicsNAV:////runp age?page=42 RunReport You can run a specific report.Module 5: Running Reports Syntax for Creating Hyperlinks The following table shows some examples of hyperlinks and provides information about how to specify parameters.Client. DynamicsNAV:///<S ervice>//RunPage?P age=<pageid> Microsoft.Na v./RunPage?Page= 22 Navigate Users can send or save quick links to specific pages. You can find this value in the CustomSettings. DynamicsNAV://///n avigate?node=<serv ice> DynamicsNAV://///navi gate?node=Home/Ite ms RunPage You can run a specific page. DynamicsNAV://<Se rverName><:Port>/ //RunPage?Page=< pageid> DynamicsNAV://MySer ver:1234///RunPage?Pa ge=22 Service instance You can specify a Service instance. DynamicsNAV:////ru nquery?query=<que ry id> DynamicsNAV:////runq uery?query=50000 RunXMLport You can run a specific XMLport. DynamicsNAV:////ru nxmlport?xmlport= <xmlport id> DynamicsNAV:////runx mlport?xmlport=99008 500 RunCodeunit You can run a specific codeunit. DynamicsNAV:////ru nreport?report=<re port id> DynamicsNAV:////runr eport?report=50000 RunQuery You can run the About This Query page for a specific query. If you specify a company then you must also specify a server and an instance.Dynamics. Parameters Description Synthax Example Company name You can switch a company (casesensitive). DynamicsNAV:////ru ncodeunit?codeunit =<codeunit id> DynamicsNAV:////runc odeunit?codeunit=500 00 Server name You can specify servers.config file.Na v. DynamicsNAV:////< CompanyName>/Ru nPage?Page=<page id> DynamicsNAV:////CRO NUS%20International% 20Ltd. If you specify an instance you must also specify a server.15 . The default port is 7046. DynamicsNAV://<Se rverName>///RunPa ge?Page=<pageid> Microsoft.Client.exe DynamicsNAV://MySer ver/ //RunPage?Page=22 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 .exe DynamicsNAV://MySer ver///RunPage?Page=2 2 Server port You can specify an optional server port number in the range 165535. type the hyperlink. and then click Run. such as Server or Service. Click OK. use percent encoding to escape any characters greater than 127 in the ASCII character set. put the hyperlink in quotation marks if there are blank spaces in the name. Enter the hyperlink in the Run window. and then enter the hyperlink URL in the Target field of the shortcut. enclose the quotation marks to make sure that spaces and other special characters are interpreted correctly. When you type a company name as a parameter. a Command Prompt. click Properties. You can run the report from the Run window. it will change the overall structure of the hyperlink. This is useful if. For URLs.Reporting in Microsoft Dynamics® NAV 2013 If you omit a parameter. and then click OK. The following demonstrations illustrate how to run hyperlinks. If you remove the accompanying forward slash. Method To run a hyperlink Run window Click Start. Shortcut Create a shortcut for the Microsoft Dynamics NAV executable on your Desktop. To type hyperlinks into a browser. you must have Microsoft Dynamics NAV installed on your computer. Run Hyperlinks In Microsoft Dynamics NAV. do not remove the accompanying forward slash. you want to run a specific report for testing. or if you know the ID of a report that is frequently run. a shortcut or from a browser window. Right-click the shortcut. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Command prompt window At the command prompt.16 Use a browser such as Internet Explorer and type the hyperlink URL directly into the address bar. and then start Microsoft Dynamics NAV. you can run report hyperlinks in different ways. Browser window 5 . Best Practice: When you enter a company name on the command line. for example. Module 5: Running Reports Method Web Reference for a web service To run a hyperlink Create a Codeunit that saves the report to PDF. Excel or Word.17 . for example an ASP. Publish the Codeunit as a web service. Create an application that includes the web service. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 .NET website. 18 Use a shortcut to run a report. and then click Run. enter the following command: Code Example “Microsoft.Client. b.exe" DynamicsNAV:////runreport?report=111 d. In the Command Prompt window. The complete target will resemble this: "C:\Program Files (x86)\Microsoft Dynamics NAV\70\RoleTailored Client\Microsoft. c.exe. c. In the Run window. Right-click the shortcut and select Properties. a. a.Client.Dynamics. In the Run dialog box. c.exe" DynamicsNAV:////runreport?report=111 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Reporting in Microsoft Dynamics® NAV 2013 Demonstration: Run a Report from the Run Window Demonstration Steps 1. Press Enter.Client. add the hyperlink URL. a.Dynamics. Click OK to run the report. Demonstration Steps 1. Run a report from the Run window.Nav.Client. 5 . you can create a shortcut to the report.Dynamics.Nav. click Start. b. enter cmd. In the Target field.exe” DynamicsNAV:///runreport?report=<ReportID> Replace <ReportID> with the report ID that you want to use 111. Run the report at the command prompt. b.Dynamics.Nav. In Microsoft Windows. Demonstration: Run a Report at the Command Prompt Demonstration Steps 1. On your Windows Desktop. enter the following command:: "C:\Program Files (x86)\Microsoft Dynamics NAV\70\RoleTailored Client\Microsoft. Click Start. Demonstration: Run a Report from a Shortcut To run a report from the Windows Desktop.Nav. create a shortcut to the Microsoft. and then click Run. The first time that you execute this command.19 . Run the report from the browser window. a. Open Microsoft Internet Explorer. and they will also be able to print specific reports. A primary goal of this portal is to provide all outgoing sales documents electronically. to conduct a small feasibility study for building a Customer Portal. Demonstration: Run a Report from a Browser Window Demonstration Steps 1. By doing this. as is shown in the Run Report Confirmation figure. Click OK to close the Properties window. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . Double-click the shortcut to run the report. enter the following URL: dynamicsnav:////runreport?report=111 c. the IT manager.8: RUN REPORT CONFIRMATION WINDOW Demonstration: Add a Report Hyperlink to a Webpage Kevin has asked Tim. Press Enter to validate the URL. In the address bar. b.Module 5: Running Reports d. you will receive a confirmation message. FIGURE 5. customers can download the documents. e. g. k. b. leave the . Run a report from a webpage. In the Location field./runreport?report=111">Customer Top 10 List</a> </div> </asp:Content> 5 . i. Click the OK button to create a new website. h.aspx. f. a. select Visual Basic. c. If the Debugging Not Enabled dialog box appears. Select File.NET Framework 4 option. select the Run without debugging option and then click the OK button.NET website template. e.Reporting in Microsoft Dynamics® NAV 2013 Tim checks whether he can start a report from a webpage. In the upper-right corner. New. Press F5 to run the website. and then open Microsoft Visual Studio 2010. Click the Source button at the bottom of the window.20 j. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In the Language field. d. Modify the code until it resembles the following line of code: Code Example <%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site. Demonstration Steps 1. Web Site. In the new website window.Master" AutoEventWireup="false" CodeFile="Default. Click Start. enter the following path: C:\Users\%USERNAME%\Documents\Visual Studio 2010\WebSites\HyperlinkTest (where %USERNAME% represents your Windows account). select the ASP.vb" Inherits="_Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <div> <a href="dynamicsnav://localhost/DynamicsNAV70/CRONUS International Ltd. b. Right-click the The Customer Top 10 List link. Open Microsoft Internet Explorer. Select Add to Favorites. In the Add a Favorite window.9: THE WEBSITE PAGE IN SOURCE VIEW WINDOW Demonstration: Add a Report Hyperlink to Favorites Now that Tim knows that links to a report can be included on a webpage. Press Enter to validate the URL.Top 10 List. Tim wants to know whether links to reports can be added to the Favorites menu in Internet Explorer. enter the following name for the report: Customer . enter the following URL: dynamicsnav:////runreport?report=111 c. Click the New Folder button. f. and he begins to run the HyperlinkTest site just created.Module 5: Running Reports The result will resemble this: FIGURE 5. a. he decides do to more testing. Demonstration Steps 1. In the address bar. Add a report to the Favorites menu.21 . d. g. e. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . Right-click the Customer Top 10 List link. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . select Favorites. FIGURE 5. The RoleTailored client will be started and the Request Options page for the report is displayed. i. 1.22 Verify the URL. Tim is satisfied with the results of his tests. m. Click the Create button to create the folder and to return to the Add a Favorite window. j. In Internet Explorer. 5 .Reporting in Microsoft Dynamics® NAV 2013 h. In the Create a Folder window. select Favorites. l. In the Create In drop-down list. enter the following Folder Name: DynamicsNAV Reports. c.10: CUSTOMER TOP 10 LIST PROPERTIES WINDOW k. Click the Add button to close the Add a Favorite window. Select Properties. In Internet Explorer. DynamicsNAV Reports. He decides to check one more thing. Notice that the Create In field points to the newly created folder. b. a. DynamicsNAV Reports. Click the Customer Top 10 List link. select Favorites. FIGURE 5. In the Customer Top 10 List Properties window.Module 5: Running Reports d.23 . click the Web Document tab.11: URL PROPERTIES WINDOW Tim knows that the URL field contains the editable link to the report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . Reports open in an application of the SharePoint site. By using the Microsoft Dynamics NAV development environment. you can type the URL directly in the address of a web browser or use it to create links to the report from other SharePoint pages. These limitations include the following: • Filtering There is a limit on the number of filters a user can set. • Printing Client-side printing is not supported. Additional Reading: For more information. If you want to filter a report. 5 . You must set up reports to print from Microsoft Dynamics NAV Server. The user can only specify one filter in addition to the number of filter fields that are set by the ReqFilterFields Property.Reporting in Microsoft Dynamics® NAV 2013 Run a Report from the SharePoint Site You can use the Microsoft Dynamics NAV Portal Framework to display Microsoft Dynamics NAV reports on Microsoft SharePoint sites. then add C/AL code to the report’s Request page in the Microsoft Dynamics NAV development environment. • Create a page action that runs the report. and then set the action to run the report.com/fwlink/?LinkId=267285 Limitations of Reports on a SharePoint Site Limitations exist when you create reports by using the Microsoft Dynamics NAV Portal Framework compared to when you use the RoleTailored client.microsoft. you can create an action to a page. To display the report. For more information.24 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . refer to How to Add Actions to a Page: http://go. Filtering is not available on the Request page for reports that are displayed in SharePoint. There are two ways to display pages and reports: • Display reports in application pages by using a URL. You can display a report on a SharePoint site by using a URL. refer to How to Specify a Printer Selection for Reports and the STARTSESSION Function. <> A placeholder for values that you must supply. a. The report is displayed in a Microsoft Dynamics NAV web client that is running on port 8080 of a computer that has the name MySharePointServer. Notation Description Text without brackets Parameters that you must type as shown. Do not include the brackets in the address.aspx?report=<ID>&[ company=<companyname>] The following table describes the notation used to indicate address syntax. Then. or send it to other people.25 . you can use it as a hyperlink to the report. instead of opening a SharePoint site and browsing to a report. The following link displays report 5 Receivables – Payables for the CRONUS International Ltd. Demonstration Steps 1. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . When you have the URL of a report. Open your browser and type the following address: http://localhost:8080/List. you can include it in other sources. Use one of the options and do not include this option in the address.&report=5 Report URL Syntax The URL to open a report in the Microsoft Dynamics NAV web client has the following syntax: Code Example <http|https>://<sharepointserver>[:<port>][/<site>]/report. Demonstration: Displaying Reports in SharePoint Sites By Using URLs When you use the Microsoft Dynamics NAV Portal Framework for Microsoft SharePoint 2010. you can open a report directly by using its URL. [] Optional parameters.aspx?company=CRONUS%20Internatio nal%20Ltd. Run the report. Do not include the brackets in the address. reports are not supported in Microsoft Dynamics NAV web parts. company. | A set of values from which to select. such as email messages or Word documents.Module 5: Running Reports Unlike pages. it can search any existing customer directly from the report. d. Import. Select Tools.microsoft. Demonstration Steps 1. 5 . • Use %20 for any spaces in values and names. printed list. when the Customer Card page is run in preview mode. By including this functionality. you can toggle on data columns and link to other data in the system. the report no longer serves as a static.aspx? report=5&company=CRONUS%20International%20Ltd. • Separate parameters after aspx? with &. Open the Microsoft Dynamics NAV 2013 demonstration database. graphics. It becomes a dynamic list that can be used for direct drill-down into system data.com/fwlink/?LinkId=267287 Hyperlinks in a Report In Microsoft Dynamics NAV 2013. So. a.aspx? For example. e. f. To find the other customer information. Additionally. before Mort can include the link in Visual Studio he must add and include a variable in a hidden text box on a section. Object Designer to open the Object Designer. b. c.aspx?company=CRONUS%20International%20Ltd. So.&report=5 yields the same as report. Click OK to start the import. report. Microsoft Dynamics NAV 2013 reports can include images.26 Add a Variable and Code to the Report.fob. Browse to the report R123456711. Michael asks Mort to include a link to the Customer Card in the report. More information about the report URL parameters is available here: http://go. he notices that only the customer number and name are included in the list. This lesson shows how to set up a report to include a link to the Customer Card page. Michael must open the Customer Card. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . However. demonstration company. Select File. Open the CRONUS International Ltd. you can create reports that provide dynamic data. Demonstration: Adding a Link in from a Report to a Page When Michael prints the Customer Top 10 List report.Reporting in Microsoft Dynamics® NAV 2013 Remember the following: • You can put parameters in any order after report. and interactive sorting. 2. Add the text box and add the line to the report. In the Name column type. the following line of code was added: Code Example CustomerRecRef. b. Select the Customer Top 10 List report.OPEN(18). and then click the Design button.0.27 . m. Mort must create a new line in the Report Dataset Designer to add the bookmark of the customer record to the dataset. In the Data Source column enter the following: Code Example FORMAT(CustomerRecRef. This line will be used to locate the value of the current customer represented in the dataset in Visual Studio after the layout is opened there.Top 10 List report by typing object ID 123456711.RECORDID. In the dialog box. click Report. l. a. add a new line at the end of the Integer dataitem. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . Click OK to import the object in the database. c. To add the line to the report. follow these steps. j.10) d.Module 5: Running Reports g. In the OnAfterGetRecord() trigger. In the Report Dataset Designer window. In the C/AL Globals of this report there’s a variable CustomerRecRef of DataType RecordRef and in the OnPreDataItem() trigger. k.GETPOSITION). and then locate the Customer .SETPOSITION(Customer. In the Data Type column select Column. CustomerBookmark. In Object Designer. choose to open the Import Worksheet window. verify that the action is set to Create. h. In the Action column. the following line of code was added at the bottom of the trigger: Code Example CustomerRecRef. i. This C/AL code will make sure the recordref variable points to the record of the customer being fetched in the report. g. Right-click the text box and select Properties. In the development environment. Save and compile the report.rdlc file for this report has changed and asks if he wants to load the changes. Save the report in Visual Studio and return to the development environment. After the bookmark is added to the Report Dataset Designer.28 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In Visual Studio. Now the newly created bookmark is part of the dataset in Visual Studio under Data Sources and its value is being referenced in the link that you are adding. Select the Go to URL option and enter the following expression in the field: Code Example ="dynamicsnav:////runpage?page=21&mode=edit&bookmark="+Fields!Custome rBookmark. set the Effects to Underline and set the Color to Blue. 5 . To compile and save the report. click View.Value Because the mode parameter is used. n. The following steps will add a link to the customer number on the report that opens the customer card for the selected customer. Mort saves the Customer . k. locate the Action tab. the user can edit the customer page. in the Body of the report. Mort can open the layout of the report and continue to modify it in Visual Studio. i. m. j. h.Top 10 List report open in Report Designer. In the Font tab.Top 10 List report.Reporting in Microsoft Dynamics® NAV 2013 The value 10 in this expression only formats RECORDID into a text representation that is compatible with the URL handler of reports and pages. He clicks Yes to save the changes in the database. The value of the text box is [Customer_No]. f. e. A message informs him that the . l. Click OK to close the window. In the Properties window. locate the text box Customer_No. and then select Layout. with the Customer . Mort must set the EnableHyperLinks property. Save and compile the report. In the development environment. Select Tools. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 .12: CUSTOMER TOP TEN REPORT WINDOW If you are resting on the customer number. enter Yes in the EnableHyperLinks property. In the Properties window. and then you can drill down into the customer's data.29 . s. r. o. you will receive a link to open the specific customer on a separate customer card. go to the last row and then click the down arrow. q. p. FIGURE 5. and then click Compile to compile the report. Click Run. Click Preview to view the report. In the Report Dataset Designer. You should set the EnableHyperlinks property to Yes only if you can make sure that hyperlinks on the report target trusted sites.Module 5: Running Reports Note: Microsoft Dynamics NAV 2013 cannot verify URLs and protect against malicious sites that can be harmful to your computer. The report lists the top 10 list of customers. Reporting in Microsoft Dynamics® NAV 2013 Demonstration: Creating a Link from a Report to a Report This demonstration will show how to set up a report to include a link from the Customer . you have a dynamic report. Select Tools. In Object Designer. select Save. m. On the File menu.Properties window. In the Report . d. and then select Design. select Properties. elect report 123456711. set the Value field to Yes if it’s not already set to Yes. g.Detail Trial Bal. The Report Dataset Designer window opens. In the dialog box. b. Demonstration Steps 1. Click OK to start the import. Open the Microsoft Dynamics NAV 2013 demonstration database. choose to open the Import Worksheet window. and then select OK to compile and save the report. Before you can add a link from a report to another report. a.fob. 5 . l. verify that the action is set to Create. Import. and now you can drill down into data. you must enable hyperlinks on the report. j. n. Enable hyperlinks on a report. select an empty row. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . c. h. Object Designer to open the Object Designer. In the Action column. in the EnableHyperlinks field.30 Close the Properties and the Report Dataset Designer windows. e. Click OK to import the object in the database. make sure Compile is selected.Top 10 List report to the Customer . report. you can select a value in the Balance (LCY) column or a section of the pie chart to view detailed balance information. the Customer Top 10 List report. By including this functionality. in the Save dialog box. k. On the View menu. When you run the Customer .Top 10 List report in preview mode and show balance data. Select File. f. In Report Dataset Designer. Browse to the report R123456711. i. select the Customer__Balance__LCY__ text box. select the Properties window. After you add the link from the balance text box to report 104 (Customer . Save the report in Visual Studio. On the File menu. in the Color field. you might want to change the format of the balance text box to indicate that the data in the text box is a link.%22No. In the Placeholder Properties window. and then select Placeholder Properties. add a link from the Balance field. select Save to save the report in Visual Studio. in the Body section of the report.Top 10 List report to report 104.% 22:"+Fields!Customer__No__. c. the Customer .). In the Properties window. report. Add a link from the Balance text box on the report to another report. To add a link from the Balance field: a. the Customer Detail Trial Bal. On the View menu. d. Click OK to close the window. g. Visual Studio opens. The value of the text box is =Fields!Customer__Balance__LCY__.Detail Trial Bal. b. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . to Underline. d. Select the Go to URL check box and enter the following expression in the Select URL text box underneath the Go to URL check box: ="dynamicsnav:////runreport?report=104&filter=Customer. f.31 . Then. locate the Customer__Balance__LCY__ text box. You can confirm this value by selecting the text box and viewing the Value property in the Visual Studio Properties window. click the Action tab. select Layout. b. In Visual Studio. e.Value 3. you add a link from the balance text box in report 111. in the Body section of the report. Select the text box. e. Expand Font and set Text Decoration. In the following procedure.Value. a. Format the Balance text box to indicate that it is a link. c.Module 5: Running Reports 2. In Visual Studio. select Blue. On the View menu. 32 a. The Balance (LCY) column is formatted as a hyperlink. report for the specified customer opens. you must now save the modified report and compile it before it you can run it. select the Action tab.Detail Trial Bal. In the development environment. The Customer .Value 5. In Visual Studio.Reporting in Microsoft Dynamics® NAV 2013 4. Click Yes to save the changes in the database. d. In the Save window. b. d. report for the specified customer opens. click Balance (LCY) and in the Chart Type drop-down list. select the pie chart. a. select the Customer Top 10 List report and click Run.%22:"+Fields!Customer__No__.rdlc file for this report has changed and asks whether you want to load the changes. 5 . in the Show drop-down list. b. g. Run the modified report. Add a link from the pie chart to report 123456711. In the development environment. Select a value in a Balance (LCY) column. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . and then click OK. Click a sector in the pie chart that represents a customer. e. In the Series Properties window. In the development environment. on the File menu. c. select Pie chart. f. The Customer . save the Customer . h.Detail Trial Bal. In Visual Studio. Click Preview to view the report. A message informs you that the .%22No. Under Options. c. Select the OK button to close the Series Properties window. The Edit-Customer. and then select Series Properties. If you click the pie chart it is also formatted as a hyperlink. select Save Report.Top 10 List report. then select Go to URL and enter the following expression in the Select URL text box underneath the Go to URL check box: ="dynamicsnav:////runreport?report=104 &filter=Customer. verify that the Compiled check box is selected.Top 10 List page for report 123456711 opens in the RoleTailored client.rldc to save and then close the report in Visual Studio. The report lists the top 10 list of customers. The Microsoft Support engineer wants to be able to view the report and report data offline instead of on a computer that has Microsoft Dynamics NAV installed.xml file. click Help. and then select About This Page to start the About This Report feature.Top 10 List report in Report Viewer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 .Top 10 List report. or change the report without having the whole Microsoft Dynamics NAV database. follow these steps. Run an Offline Report Viktor is a Microsoft Certified Partner working for CRONUS International Ltd. This can be useful when the report does not include a particular dataset or it has rendering issues. On the computer that has Microsoft Dynamics NAV installed. select Customer . it can be useful when a developer does not have access to the Microsoft Dynamics NAV installation. Additionally. To export the report dataset to an . 5. This new functionality is explained in this section. In the RoleTailored client. He is working on some improvements to the Customer . On the Request page for the Customer . On the request page for the Customer . you can share both the layout and the dataset to debug and. 3.Top 10 List report. Close the About This Page page. However.Top 10 List report. 4.Top 10 List.33 .Module 5: Running Reports Run a Stand-Alone Report in Visual Studio In Microsoft Dynamics NAV 2013. who runs the report on his computer by using Visual Studio. on the Report tab. Viktor exports the report dataset to an . 2.xml file. he has encountered some problems. on the Application menu. Viktor wants to send the report to Microsoft Support to help him troubleshoot the problems. open the RoleTailored client. 1. click Preview to open the Customer . during his development phase. Viktor saves the report dataset and the report layout and sends them to the Microsoft Support engineer. Saving the report dataset and layout First. follow these steps. note the path where the Report. 3. and then in the Properties window. in Solution Explorer. click Help. 2. Viktor must save the report layout as an . In the Export File dialog box.rdlc file.Top 10 List. 4. select Report. In the development environment. 8.rdlc file. browse to your desktop. and then click Save. click Tools. On the About This Report page. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .Reporting in Microsoft Dynamics® NAV 2013 6. select report 111. 7. click Report. enter Dataset for the file name. 9. on the Application menu.rdlc file is located. Customer . On the View menu.rdlc. In Object Designer. On the report preview. set the Save type field to XML (*. In Visual Studio. 5 . click Save.34 1. In the Export File dialog box.xml). To copy the report layout . Next. and then click Object Designer. select Export as XML. and then select About This Report to display the report dataset. click Layout to open the report layout in Visual Studio. and then click Design. and then click Project. open Visual Studio. To run the report by using Visual Studio.Module 5: Running Reports 5. under Installed Templates.rdlc file from the location in the Properties window to your desktop. Viktor sends both the Dataset. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . Copy the Report. and then select Existing Item. Running the Report Offline The Microsoft Support engineer has received the Dataset.35 . 4.rdlc file from Viktor and now he or she runs the report on his or her computer by using Visual Studio. follow these steps. 1. enter OfflineReport. 3. expand Visual C#. In Solution Explorer. In Visual Studio. On the second computer.xml file and the Report. 5. in the File menu.rdlc file to the Microsoft Support engineer who is helping him troubleshoot the report. right-click the OfflineReport project. In the New Project window. select Windows. select Add. click New.xml file and the Report. and then click the OK button to create the solution. In the Name field. and then select Windows Forms Application. 2. Note: If your report includes external images. replace the code with the following: Code Example using System. select Dataset. 7. 13. under Installed Templates. In the Add Existing Item dialog box. In Solution Explorer.Report. 8. and then set the ReportEmbeddedResource property. click Add.xml file and the Report. select the Dataset. In the CreateDataSource. 10. then in the Properties window of the report viewer control. under Reporting.Linq. and then click Class. you must set the EnableExternalImages property to True. Select the report viewer control. then in the Properties window of the report viewer control. In the Toolbox dialog box.Data. and then select Add. to OfflineReport. enter CreateDataSource. browse to your desktop. set the file type to All Files (*. you must set the EnableHyperlinks property to True. using System.Reporting in Microsoft Dynamics® NAV 2013 6.xml.Collections. select Copy Always from the drop-down list.Generic. under Misc. and then click Add. and then in the Properties window.cs.Text. using System. in the Copy to Output Directory field. under OfflineReport. In the Add New Item window. In the Properties window. namespace OfflineReport { public static class CreateDataSource { public static DataTable CreateTable() 5 . 11. and then click Class. using System. select Visual C# Items. drag a new Report Viewer control to Form1. expand Local Report.*).cs tab.rdlc. 9. 12. Note: If your report includes hyperlinks. In the Name field. select the OfflineReport project.36 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In Solution Explorer. using System.rdlc file. Tables[0]. using System.cs [Design] tab.Linq. using System. 16. using System. In the Form1.cs tab.Forms. return dataSet.Module 5: Running Reports { DataSet dataSet = new DataSet(). namespace OfflineReport { public partial class Form1 : Form { public Form1() Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . using System. On the File menu. using System. 15.37 .Drawing. using System. Select the Form1. click Save CreateDataSource.Collections.Generic.Text. and then on the View menu.Reporting.ReadXml("Dataset. replace the code with the following: Code Example using System.Data. using System.Windows.WinForms.cs. click Code.ComponentModel.xml"). dataSet. } } } 14. using Microsoft. click Build Solution.Add(new ReportDataSource("DataSet_Result". On the Build menu. The solution builds successfully. On the Debug menu.reportViewer1.LocalReport. 5 . this. CreateDataSource. } private void Form1_Load(object sender.38 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . } } } 17.DataSources. EventArgs e) { this.Reporting in Microsoft Dynamics® NAV 2013 { InitializeComponent().reportViewer1.RefreshReport(). 18. click Start Debugging to view the report in the report viewer control.CreateTable())). com/fwlink/?LinkId=267288 Microsoft Dynamics Developer Center The Microsoft Developer Network (MSDN) Developer Centers and Resource Centers collect content and resources related to specific products and technologies.microsoft.xml and Report.rdlc files. To make a change to the report layout. technical articles and documentation. To go directly to the SSRS section. Microsoft Dynamics® NAV.com/fwlink/?LinkId=267291 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 .com/fwlink/?LinkId=267289 Microsoft SQL Server Development Center The Microsoft SQL Server Development Center contains all kinds of resources and information about development in Microsoft SQL Server®. communities and (team) blogs. http://go.microsoft. and Microsoft Dynamics® SL). http://go.microsoft. to run other reports from Visual Studio.39 .com/fwlink/?LinkId=267290 In the Microsoft SQL Server Reporting Services (SSRS) section of the SQL Server Developer Center. getting started and learning information. The Microsoft Dynamics NAV Team Blog This blog site of the Microsoft Dynamics NAV Product team contains technical articles and resources about Microsoft Dynamics NAV.rdlc. upcoming events. The Microsoft Dynamics Developer Center provides access to all kinds of development resources for all five Microsoft Dynamics products: (Microsoft Dynamics® AX. community sites. Additionally. http://go. click the following link: http://go. it contains links to newsgroups. in Solution Explorer. It offers general information such as product highlights.Module 5: Running Reports 19. Microsoft Dynamics® GP. you can find all kinds of resources related to reporting in SSRS. Microsoft Dynamics® CRM. you have to replace the Dataset. They connect you to code samples.microsoft. rightclick Report. and then click Open. Note: Now that you have created the OfflineReport solution. and much more. Interesting Links This section provides a list of hyperlinks and resources to use to obtain information about Microsoft Dynamics NAV 2013 and reporting. http://go. http://go.microsoft.microsoft.Reporting in Microsoft Dynamics® NAV 2013 Microsoft Visual Studio The following is the home page of the Microsoft Visual Studio product family. system requirements.com/fwlink/?LinkId=267294 Microsoft Dynamics NAV 2013 Launch Portal The Launch Portal references tools. and content that you can use to kick start Microsoft Dynamics NAV 2013 readiness. and forums. The page includes software downloads.40 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .com/fwlink/?LinkId=267293 Creating and Consuming a Codeunit Web Service This walkthrough provides an overview of how to create and consume a simple web service that uses Microsoft Dynamics NAV. samples and resources. http://go. This material supplements the communications and processes that are provided by your local Microsoft country or regional organization. installing.com/fwlink/?linkid=126282 User Experience Guidelines for Microsoft Dynamics NAV 2013 The Microsoft Dynamics NAV 2013 User Experience Guidelines (or “UX Guide” for short) is a tool to help Microsoft Dynamics NAV Independent Software Vendors (ISVs) in building more user-friendly applications. information about Frequently Asked Questions (FAQ). A PartnerSource sign in is required. installation topics. http://go. and managing Microsoft Dynamics NAV 2013.com/fwlink/?LinkId=267296 Microsoft Dynamics NAV 2013 Developer and IT Pro Help The Microsoft Dynamics NAV 2013 Developer and IT Pro Help provides information about developing for.com/fwlink/?LinkId=267292 Microsoft Visual Studio Express Editions This site contains resources for the Microsoft Visual Studio Express Editions. By using the Microsoft UX Guide proactively during your development process.microsoft.microsoft. help resources.com/fwlink/?linkid=126283 Updates to the developer and IT Pro Help. with both new content and improvements to existing content can be downloaded from the following page: http://go. http://go. training. you can save time and avoid design 5 .microsoft.microsoft. microsoft.Module 5: Running Reports violations. http://go.41 . and XML Schema for presenting reports.microsoft.com/fwlink/?LinkId=267300 The Microsoft Dynamics NAV Technical Community This site offers a several tools to help you connect and collaborate with other Microsoft Dynamics NAV users. http://go. developers and implementers. http://go.com/fwlink/?LinkId=267299 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 .com/fwlink/?LinkId=267298 SQL Server 2008 Report Definition Language Specification This document specifies the structure and semantics of the SQL Server 2008 Report Definition Language (RDL).microsoft.com/fwlink/?LinkId=267297 Microsoft Dynamics NAV Developer Documentation This page contains links to several technical articles related to development in Microsoft Dynamics NAV.microsoft. http://go. to the Role Center menu for Prakash and the other project managers. Additionally.1: Add a Report to the RoleTailored Client Scenario Prakash wants his Resource . Add report 123456706 that is created in Lab 4. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Click Yes to start the import.42 Add report 123456706 that is created in Lab 4.2. demonstration company. Detailed Steps 1. Additionally. Task 1: Add the Report to the Job Project Manager RC Page. Exercise 1: Add a Report to the RoleTailored Client Exercise Scenario Add report 123456706 that is created in Lab 4. High Level Steps 1. e. f.2 (Creating a TOP X Report). d. to the Role Center menu for Prakash and the other project managers. h. Select Tools. Select File. choose to open the Import Worksheet window. In the Action column.2. In the dialog box. Open the CRONUS International Ltd.Utilization (Chart) Report (report 123456706) to be available from the Role Center menu so that he and other project managers can access it from the RoleTailored client. to the RoleTailored client interface. Objectives In this lab. 5 . b.fob. Browse to the object P123456700. a. verify that the action is set to Create. Open the Microsoft Dynamics NAV 2013 demonstration database. g. you will add one of the reports that you built in earlier modules.Reporting in Microsoft Dynamics® NAV 2013 Lab 5. create a new MenuSuite object to make the report available under the Reports and Analysis category in the Resources section of the Departments page. to the Role Center menu for Prakash and the other project managers. Import. Object Designer to open the Object Designer. he wants it to be available from the Resources page in the Departments section (under the Reports and Analysis category). c. in case it’s not already open. He asks Mort to make it available in the menu on the Role Center page. In the Microsoft Dynamics NAV development environment. Scroll down to the Action that has Jobs per Item as its Caption. In the Microsoft Dynamics NAV development environment. s. and then Properties to open the Properties window for the new action. Create the Menusuite object. New). Select an empty line in the designer.Module 5: Running Reports i. t. b. click the dropdown arrow and select report 123456706 in the Object List window. k. Detailed Steps 1. j. Task 2: Create a New MenuSuite Object High Level Steps 1. Compile and save the page.Partner level. a. Job Project Manager RC2. and then Page Actions to open Action Designer. Scroll down to the ActionContainer that has HomeItems as its Subtype. n. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . l. r. m. enter a name for the action: Resource . v. In the menu. p. Press F3 to insert a new empty line (or select Edit. Click the Page button. Click the New button to open the Design Level window. d. Select View. In the Value field of the RunObject property. in the Caption field. Click View. On the new line. In the Type field. In the list box. Click the Separator button to insert a separator. q.Utilization (Chart). u. c. Click OK to import the object in the database.43 . open Object Designer. Create the Menusuite object. w. open Object Designer. o. select Dept . Select page 123456700. select Action. Click the MenuSuite button. Click Design to open the page in Page Designer. e. Select the button to the right of the Owner ID field. In the Department Category field. b. To set permissions to the profile. Add the Report to the Departments Section. Detailed Steps 1. select the Resource Planning menu. g. e. h. c. Click OK to close the Create Item window. Right-click the last report in the Reports group (Resource Price List) and select Create Item. Compile and save the MenuSuite. a. a. The Users window opens. 5 . h. select Report in the Object Type field. The profile card of the PROJECT MANAGER now opens. b. f. change the caption to Resource Utilization (Chart). In the Caption field. In the Create Item window. d. c. Click OK to close the profile card of the PROJECT MANAGER. follow these steps. Select the profile of the PROJECT MANAGER and double click. i. Detailed Steps 1. Add the Report to the Departments Section. In the Object ID field. f.Reporting in Microsoft Dynamics® NAV 2013 Task 3: Change the MenuSuite Object to Add the Report to the Departments Section High Level Steps 1. type 123456706. Task 4: Set Permission to Configure the Report High Level Steps 1. d. select Reports and Analysis. Expand the Reports group. Select the Administrator user and click OK. follow these steps. In the Navigation Pane Designer.44 To set permissions to the profile. Open the Dynamics NAV Client. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In the search box at the right top of the screen type: Profiles. g. browse to the following path and application: C:\Program Files(x86)\Microsoft Dynamics NAV\70\RoleTailored Client\Microsoft.exe. g. Click the OK button. d. e.Client.Dynamics. Enter the following name for the shortcut: Project Manager Profile. f. a.Nav. b. In the Create Shortcut window. click the Next button. Detailed Steps 1. Click the Finish button.exe" -configure profile:"Project Manager" d. Click the Apply button. Modify the New Shortcut for the RoleTailored client. Change the Target field to: "C:\Program Files(x86)\Microsoft Dynamics NAV\70\RoleTailored Client\Microsoft. Task 6: Change the New Shortcut for the RoleTailored Client High Level Steps 1.Client. c. click the Browse button. Detailed Steps 1.Nav. In the Create Shortcut window. Select Properties. In the Browse for Folder window. Click the OK button to close the Browse for Folder window. e. Create a New Shortcut for the RoleTailored client. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 .Dynamics. b. Right-click the Windows Desktop and select New > Shortcut. a.Module 5: Running Reports Task 5: Create a New Shortcut for the RoleTailored client High Level Steps 1. c. Create a New Shortcut for the RoleTailored client. Modify the New Shortcut for the RoleTailored client.45 . Right-click the newly created shortcut. b. Use the shortcut to run the RoleTailored client that has the Project Manager profile. FIGURE 5. Click the Departments menu. double-click the Project Manager Profile icon. Now the Resource .Reporting in Microsoft Dynamics® NAV 2013 Task 7: Start the RoleTailored Client that has the Project Manager Profile (in Configuration Mode) High Level Steps 1. Use the shortcut to run the RoleTailored client that has the Project Manager profile.17: ROLE CENTER PAGE WINDOW c. Detailed Steps 1. On the Windows Desktop. On the Role Center page. click the Report menu. 5 . Click the Resource Planning section. a.Utilization (Chart) Report is listed under the Reports and Analysis category (as the bottom report in the Reports group).46 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . d. c. open Object Designer. d. Mort views this as an excellent opportunity to develop a self-serving customer portal.2: Call a Report from a Web Service Scenario Susan regularly receives requests and questions from customers about sales invoices and shipments. High Level Steps 1.47 . a. Create a New Codeunit. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . Rebecca receives several requests to resend lost or missing documents to the customers. After Susan records all the details. it will show how to build a small web application that includes the web service. In the ID field. e.Module 5: Running Reports Lab 5. Click the Codeunit button. Objectives In this lab. Select File. Susan and Rebecca want to quickly search a document (by number). So. Create a New Codeunit. she sends the information to the representative who is responsible for handling the requests and questions. Click the New button. you will build a codeunit and expose it as a web service. it does not focus on how to define the appropriate application security. At the same time. and print a copy of it so that they can add it to the case or send it to the customers. Exercise 1: Run a Report from a Web Service Task 1: Create a New Codeunit. Although this lab is educational. To better and faster serve the customers. Detailed Steps 1. it is highly recommended not to implement the lab in a live production environment. enter 123456701. Although this course is not a web development course. b. Save As. In the Microsoft Dynamics NAV development environment. enter SalesInvHdr. a. select Record. In the Subtype field. In the DataType field. g. Task 2: Add Global Variables to the Codeunit High Level Steps 1. k. In the DataType field. Click OK. c. h. enter FileName. j. In the Length field. Add global variables to the codeunit.Reporting in Microsoft Dynamics® NAV 2013 f. In the Name field. C/AL Globals to open the C/AL Globals window. b. Add global variables to the codeunit. enter SalesCMHdr. i. enter Get Sales Document WS. h. m. Detailed Steps 1. select Record. Select the next line. On the Variables tab. click the button and select the Sales Cr. In the Name field. l. enter 250. Select View. 5 . Select the next line.48 n. g. select the first (empty) line. e. In the Name field. d. Select the next line. o. In the Name field. In the Subtype field. Check the Compiled field. enter SalesShptHdr. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In the Name field. select Text. f.Memo Header table from the Table List window. click the button and select the Sales Invoice Header table from the Table List window. In the DataType field. enter DocNo. select the first empty line. a. click the Functions tab. In the Name field. m. Click the Return Value tab. select Record. i. l. select Integer. enter CheckDocNo. f. enter DocType. Detailed Steps 1. In the Name field. On the Parameters tab. enter 20. Click File.49 . In the DataType field. Select the next line. select Integer. Save to save and compile the codeunit. On the first empty line. e. In the DataType field. Add the CheckInvoiceNo function to the codeunit.Module 5: Running Reports p. In the Subtype field.18: THE C/AL GLOBALS WINDOW r. c. k. Add the CheckInvoiceNo function to the codeunit. h. select Code. b. Task 3: Add the CheckInvoiceNo function to the Codeunit High Level Steps 1. d. g. FIGURE 5. In the Length field. In the DataType field. Close the C/AL Locals window. In the Return Type field. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . j. q. In the C/AL Globals window. Place the pointer on the line that contains the CheckDocNo function and then click the Locals button to open the C/AL Locals window. click the button and select the Sales Shipment Header table from the Table List window. enter the following code in the CheckDocNo() function trigger: Code Example CASE DocType OF 110: BEGIN IF SalesShptHdr.GET(DocNo) THEN BEGIN EXIT(1) END ELSE EXIT(0). In the C/AL Editor. END.Reporting in Microsoft Dynamics® NAV 2013 Task 4: Add Code to the CheckDocNo Function High Level Steps 1. Detailed Steps 1.GET(DocNo) THEN BEGIN 5 .GET(DocNo) THEN BEGIN EXIT(1) END ELSE EXIT(0). 114: BEGIN IF SalesCMHdr.50 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . END. Add code to the CheckDocNo function. a. Add code to the CheckDocNo function. 112: BEGIN IF SalesInvHdr. b. Detailed Steps 1. In the C/AL Globals window. On the Parameters tab. click the Functions tab.51 . Click File and then click Save to compile the codeunit. Place the pointer on the line that contains the GenerateReport function and then click the Locals button to open the C/AL Locals window. END.Module 5: Running Reports EXIT(1) END ELSE EXIT(0). select the first empty line. enter GenerateReport. On the first empty line. c. END. The function trigger will resemble this: FIGURE 5.19: SALES INVOICE REPORT Task 5: Add the GenerateReport Function to the Codeunit High Level Steps 1. b. d. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . a. Add the GenerateReport function to the codeunit. Add the GenerateReport function to the codeunit. In the C/AL Editor. 2. Add code to the GenerateReport function. Detailed Steps 1. In the Length field. FileName := FileName + '. enter 20. select Integer. '{-}'). In the Length field. enter DocType. Create the temp folder. DocNo). select Text. n. j. In the Name field.SETRANGE("No. SalesShptHdr). Click the Return Value tab.FINDFIRST THEN REPORT. FileName := FileName + FORMAT(CREATEGUID). FileName. Select the next line. In the Name field. Add code to the GenerateReport function. l. enter DocNo.". In the Return Type field. f. In the DataType field. '='.Reporting in Microsoft Dynamics® NAV 2013 e.52 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . END. FileName := DELCHR(FileName. IF SalesShptHdr. k. // Print the Document IF DocType = 110 THEN BEGIN SalesShptHdr. g. Close the C/AL Globals window to return to the C/AL Editor. select Code. Task 6: Add Code to the GenerateReport Function High Level Steps 1. 5 . m. enter the following code in the GenerateReport() function trigger. enter 250. a. o.SAVEASPDF(208. In the DataType field.pdf'. h. Close the C/AL Locals window. Code Example // Determine the PDF File Name FileName := 'C:\temp\'. i. END. Close Object Designer.SAVEASPDF(207.FINDFIRST THEN REPORT. Click File and then click Save to compile the codeunit.". DocNo).SAVEASPDF(206. FileName. The function trigger will resemble this: FIGURE 5. END. IF SalesInvHdr. SalesCMHdr).53 . d. IF DocType = 114 THEN BEGIN SalesCMHdr. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . SalesInvHdr). DocNo). IF SalesCMHdr. EXIT(FileName). Close the C/AL Editor.SETRANGE("No.".Module 5: Running Reports IF DocType = 112 THEN BEGIN SalesInvHdr. b.SETRANGE("No.FINDFIRST THEN REPORT.20: CODE EXAMPLE WINDOW c. FileName. browse to: Departments > Administration > IT Administration > General. In the Web Services window. h. d. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In the Object ID field. click the New button. Expose the Codeunit as a web service. a. c. On the C:\ drive create a new folder called temp.54 Expose the Codeunit as a web service. g. a. Task 7: Expose the Codeunit as a Web Service High Level Steps 1.Reporting in Microsoft Dynamics® NAV 2013 2. enter Get_Sls_Doc. Detailed Steps 1. 5 . and then click the OK button. In the Service Name field. b. Put a check mark in the Published field. select Codeunit. Create the temp folder. Select WebServices in the Lists category. In the Object Type field. In the RoleTailored client. The codeunit is now exposed as a web service. f. e. enter 123456701. NET Web Site template. In the New Web Site window. Task 9: Create a New Website High Level Steps 1. select the ASP. Test the availability of the new web service. enter the following path: C:\Users\Administrator\Documents\Visual Studio 2010\WebSites\Lab52 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . New. b. In the Location field. In the browser bar. Detailed Steps 1. Test the availability of the new web service. c.Module 5: Running Reports Task 8: Test the Availability of the New Web Service High Level Steps 1. Select File.55 . Create a new website. Open Internet Explorer. Select Start > All Programs > Microsoft Visual Studio 2010 > Microsoft Visual Studio 2010. b. Web Site. Detailed Steps 1. Create a new website. a. d. enter the following URL: http://localhost:7047/DynamicsNAV70/WS/services The newly published web service appears in the list that uses the service name that is specified in the Web Services window. a. Split and Source buttons at the bottom of the ASP Editor window. select the Label control. select the text box control. In the Toolbox window. Click the Design button to switch to the design view.Reporting in Microsoft Dynamics® NAV 2013 e. With the Text box control selected. Add controls to the website. f. Drag it inside the <p> element.aspx page. g. The result should resemble this: The ASP Editor window in the middle displays a tab for the default page of the website. In the Toolbox dialog box. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . i. f. g. a. right next to the text box. Remove the code in the last asp:content tag. Drag it inside the <p> element on the default. select Visual Basic. h. 5 .aspx.56 Add controls to the website. Notice the Design. e. In the Toolbox window. The control remains selected on the design surface. b. under the RadioButtonList. c. Press the right arrow to place the pointer next to the control. select the RadioButtonList control. press the spacebar two times to insert two blank spaces after the control. Press Enter. Task 10: Add Controls to the Website High Level Steps 1. d. In the Language field. Drag it inside the <p> element. Detailed Steps 1. a. Click the OK button to create the new website. This is called default. set the (ID) property to txtDocNo. l. Set the Name property to Verdana. a. g. Design the controls on the website. Detailed Steps 1. b. set the (ID) property to lblErrorMsg. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 .Module 5: Running Reports j. In the Properties window. With the Label control selected. Press Enter.57 . Set the Size property to Small. Task 11: Design the Controls on the Website High Level Steps 1. Design the controls on the website. The result will resemble this. Select the Label control. f. Expand the Font property collection. In the Properties window. e. select the Button control. Drag it inside the <p> element. under the text box control. press the right arrow key to place the cursor next to the control. Select the text box control. k. In the Toolbox window. c. d. m. Reporting in Microsoft Dynamics® NAV 2013 h. Set the ForeColor property to Red. i. Set the Text property to Error Message. j. Set the Visible property to False. k. Expand the Font property collection. l. Set the Bold property to True. m. Set the Name property to Verdana. n. Set the Size property to Small. o. Select the Button control. p. In the Properties window, set the (ID) property to cmdSearch. q. Set the Text property to Search. r. Expand the Font property collection. s. Set the Name property to Verdana. t. Set the Size property to Small. u. Select the RadioButtonList control. v. In the Properties window, set the (ID) property to rblDocType. w. Expand the Font property collection. x. Set the Name property to Verdana. y. Set the Size property to Small. z. Click the angle bracket (>) button on the upper-right corner of the RadioButtonList control. aa. In the RadioButtonList Tasks pane, select Edit Items. bb. In the ListItem Collection Editor window, click the Add button. cc. In the ListItem properties window, set the Text property to Posted Invoice. dd. Change the Value property to 112. ee. Set the Selected property to True. ff. Click the Add button. (The newly added item will appear in the Members list.) gg. In the ListItem properties window, set the Text property to Posted Credit Memo. hh. Change the Value property to 114. ii. Click the Add button. (The newly added item will appear in the Members list.) jj. In the ListItem properties window, set the Text property to Posted Shipment. kk. Change the Value property to 110. ll. Click the OK button to close the ListItem Collection Editor window. mm. 5 - 58 Click File and then click Save to save the file. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 5: Running Reports The result will resemble this: Task 12: Add the Web Service Reference High Level Steps 1. Add the web service reference. Detailed Steps 1. Add the web service reference. Because including a web service is not part of the scope for this training, it is recommended to check the online help for Microsoft Dynamics NAV 2013 or the MSDN website at http://go.microsoft.com/fwlink/?LinkId=267301. a. In the Solution Explorer window, right-click the Lab52 project and select the Add Web Reference button to open the Add Web Reference window. In case the Add Web Reference button is not available then in the Solution Explorer window, right-click the Lab52 project and select the Add Service Reference ,click the Advanced button, in the Service Reference Setting window click the Add Web Reference button to open the Add Web Reference window. b. In the URL field, enter http://localhost:7047/DynamicsNAV70/WS/services. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 - 59 Reporting in Microsoft Dynamics® NAV 2013 c. Click the Go button. d. In the left list box, Discovery Page, click the View Service link for the Get_Sls_Doc service. e. Click the Add Reference button to add a reference to the web service. Task 13: Add Code to Include the Web Service High Level Steps 1. Add code to include the webservice. Detailed Steps 1. Add code to include the webservice. a. Click the Default.aspx tab. b. Double-click the Search button in Design view. c. On the Default.aspx.vb tab, enter the following line of code in the cmdSearch_Click procedure. Code Example Dim service As localhost.Get_Sls_Doc = New localhost.Get_Sls_Doc Dim pdfFileName As String Dim DocCheck As Integer service.UseDefaultCredentials = True 5 - 60 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 5: Running Reports service.Url = "http://localhost:7047/DynamicsNAV70/WS/CRONUS%20International%20Ltd./Co deunit/Get_Sls_Doc" DocCheck = service.CheckDocNo(rblDocType.SelectedValue, txtDocNo.Text) If DocCheck = 0 Then lblErrorMsg.Text = rblDocType.SelectedItem.Text & " " & txtDocNo.Text & " was not found." lblErrorMsg.Visible = True txtDocNo.Text = "" Else lblErrorMsg.Visible = False service.UseDefaultCredentials = True service.Url = "http://localhost:7047/DynamicsNAV70/WS/CRONUS%20International%20Ltd./Co deunit/Get_Sls_Doc" Response.ContentType = "application/pdf" pdfFileName = service.GenerateReport(rblDocType.SelectedValue, txtDocNo.Text) Response.TransmitFile(pdfFileName) End If Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 - 61 Reporting in Microsoft Dynamics® NAV 2013 The result will resemble this: d. Click File, Save All to save the modified files. Task 14: Run the Web Application High Level Steps 1. Run the web application. Detailed Steps 1. 5 - 62 Run the web application. a. On the Default.aspx page, press F5. b. If the Debugging Not Enabled dialog box is displayed, select the Start without debugging option and click the OK button. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 5: Running Reports The result will resemble this: Task 15: Test the Web Application High Level Steps 1. Test the web application. Detailed Steps 1. Test the web application. To test the application, use the following scenario. a. Select the Posted Shipment option. b. In the text box, enter 103007. c. Click the Search button. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 - 63 Reporting in Microsoft Dynamics® NAV 2013 5 - 64 d. Select the Posted Invoice option. e. In the text box, enter 103007. f. Click the Search button. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement Module 5: Running Reports Module Review Module Review and Takeaways This module described how to run a report from the Role Tailored Client from a Page, Role Center and Departments section. It also explained how to create hyperlinks from and to reports and pages and how to run a report from the SharePoint Site. There’s a description on how to run a report standalone in Visual Studio for debugging purposes. The labs in this module enforced knowledge on how to add a report to the application and how to consume a report as a web service. Test Your Knowledge Test your knowledge with the following questions. 1. Which functionalities are available from the ReportViewer Control Toolbar? ( ) Find ( ) Save Page Setup ( ) Browse ( ) Sort 2. Which property determines whether a menu or menu group will be included as a page in the Departments page of the RoleTailored Client? ( ) Department Menu ( ) Department Page ( ) Department Level ( ) Department Category 3. Which department categories are available in the Create Item window? ( ) Lists, Tasks, Reports and Analysis, Documents, Departments, Home ( ) Lists, Tasks, Reports and Analysis, Documents, History, Setup ( ) Lists, Tasks, Reports and Analysis, Documents, History, Administration ( ) Lists, Tasks, Reports and Analysis, Documents, Departments, Periodic Activities Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 - 65 ( ) They compromise the Departments page. ( ) They are stored inside the MenuSuite object for the Classic client.66 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . What is true about MenuSuites for the RoleTailored client? ( ) They are stored as separate MenuSuite objects. 5 . ( ) They compromise the navigation pane.Reporting in Microsoft Dynamics® NAV 2013 4. What is the RoleTailored client's equivalent for the navigation pane? ( ) The Role Center Pages ( ) The Activities Pages ( ) The Action Pane ( ) The Departments Page 5. Documents. Tasks. Reports and Analysis. Documents. Documents. Tasks. Which functionalities are available from the ReportViewer Control Toolbar? (√) Find ( ) Save Page Setup ( ) Browse ( ) Sort 2. Which department categories are available in the Create Item window? ( ) Lists.67 . Periodic Activities 4. History. Which property determines whether a menu or menu group will be included as a page in the Departments page of the RoleTailored Client? ( ) Department Menu (√) Department Page ( ) Department Level ( ) Department Category 3. Documents. Home ( ) Lists. Reports and Analysis.Module 5: Running Reports Test Your Knowledge Solutions Module Review and Takeaways 1. Departments. Administration ( ) Lists. What is the RoleTailored client's equivalent for the navigation pane? ( ) The Role Center Pages ( ) The Activities Pages ( ) The Action Pane (√) The Departments Page Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 5 . Tasks. Departments. Reports and Analysis. Reports and Analysis. History. Tasks. Setup (√) Lists. ( ) They compromise the Departments page. ( ) They are stored inside the MenuSuite object for the Classic client. ( ) They compromise the navigation pane.68 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . 5 . What is true about MenuSuites for the RoleTailored client? (√) They are stored as separate MenuSuite objects.Reporting in Microsoft Dynamics® NAV 2013 5. • Import and upgrade a report that has only a Classic report layout to a Microsoft Dynamics NAV 2013 report that has an RDLC layout. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6-1 . • Build the request page. • Explain how to use the dataset for the report dataset designer. this module explains how to migrate reports to Microsoft Dynamics NAV 2013. • Describe how to upgrade classic reports. To avoid the loss of work. • Apply report design UX guidelines. • Apply dataset optimization techniques in reports. • Implement report dataset optimization.MODULE 6: UPGRADE REPORTS Module Overview In Microsoft Dynamics® NAV 2013. reports from an earlier version are migrated to Microsoft Dynamics NAV 2013. • Describe the upgrade process and flow of reports to the RoleTailored client. • Optimize performance. Objectives The objectives are: • Explain the report upgrade workflow for different report types. Typically. • Modify the RDLC layout. you can create reports or you can import reports from earlier versions of Microsoft Dynamics NAV. Then. However. the classic report layout and the Request form are deleted. the field information from the report sections is converted to a dataset definition that is valid for Microsoft Dynamics NAV 2013 reports. 6-2 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . you can compile. In Microsoft Dynamics NAV 2013. If you import a report from Microsoft Dynamics NAV 2009 that has both the classic report layout and the RDLC report layout. When you upgrade a report. • A hybrid report that contains both the classic report layout (sections) and the (optional) request form and an RDLC report layout and (optional) request page. You can create a request page for the report or you can use the form transformation tool to transform a request form to a request page. Dynamics NAV 2013 uses RDLC 2008 and this implies an adjustment and modification to convert and upgrade of the RDLC XML source file. If this is the case. In Microsoft Dynamics NAV 2009. you could have deleted the RDLC layout from a report so that you could view the Classic layout only. In Microsoft Dynamics NAV 2013. If you import a report that has only a Classic report layout and request form. your report does not contain an RDLC layout or a request page. Upgrading a Report Upgrading reports is an automated process that extracts dataset information and deletes unnecessary classic report components from the report object. you cannot run or design a report that has a classic report layout. You can also have a report from a version that is from an earlier version of Dynamics NAV.Reporting in Microsoft Dynamics® NAV 2013 How to Upgrade a Report to Microsoft Dynamics NAV 2013 This lesson explains the upgrade process for reports from an earlier version of Microsoft Dynamics NAV to Microsoft Dynamics NAV 2013. a report object can contain only an RDLC layout and request page. then when you upgrade the report. then you must upgrade that report. For example. • Client report definition (RDLC) layout and (optional) request page. • A ProcessingOnly report without a layout. You can have reports that do not have RDLC layouts. an RDLC report layout is created automatically. a report object can contain the following combinations of components: • Classic report layout (sections) and (optional) request form. 1: UPGRADE HYBRID REPORT WORKFLOW SCREENSHOT Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6-3 .Module 6: Upgrade Reports After you upgrade a report. FIGURE 6. To convert a report to RDLC 2008 format. Upgrade the Path for a Hybrid Report The steps that are required to upgrade a hybrid report are outlined in the following flowchart. it is converted from an RDLC 2005 format to an RDLC 2008 format. open the report in either Visual Studio 2010 Report Designer or from the RoleTailored client that uses Report Viewer 2010. FIGURE 6. The steps that are required to upgrade a processing only report are outlined in the following flowchart. you must first compile the report.2: UPGRADE PROCESSING ONLY REPORT WORKFLOW SCREENSHOT 6-4 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Upgrade the Path for a Processing Only Report A processing only report is a report without a layout. The report does not produce any printed output.Reporting in Microsoft Dynamics® NAV 2013 Best Practice: For the Upgrade Report to work. This type of report processes data. The steps that are required to upgrade a Classic report are outlined in the following flowchart.Module 6: Upgrade Reports Upgrade the Path for a Classic Report A Classic report is a report that contains a Classic layout but no RDLC layout. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6-5 . On the Tools menu. on the Tools menu. In the development environment. use one of the following methods: • Export the reports to a file. Import the report that you want to upgrade into Microsoft Dynamics NAV 2013. 4. 6. Compile. The Classic report layout and request form for each report is deleted during the upgrade. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . it is recommended that you create a backup of the reports. and then click Design.4: CONFIRM UPGRADE OF REPORT SCREEN SHOT 6-6 7. FIGURE 6. Click the Yes button to confirm that you want to upgrade the reports. and then select the report that you want to upgrade.Reporting in Microsoft Dynamics® NAV 2013 The Upgrade Process Before you upgrade reports. 3. Note: Verify that you have Visual Studio 2010 installed.) 8. You cannot undo the upgrade after it is finished. (The Transformation Tool could be used to transform it to a Request Page. 5. click Object Designer. To compile the report. This includes the Visual Web Developer feature. click Report. (FOB. In Object Designer. TXT or XML) • Create a backup of the database. You can use any of the following editions of Visual Studio 2010: • Premium • Ultimate To upgrade a report. 2. follow these steps. Select the report that you upgraded. To back up reports. click Upgrade Report. click Tools. 1. For example. and then click the OK button. By understanding the report and the features that are available in Visual Studio Report Designer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6-7 . click Compile. 12. On the View menu. 14. click Save Report. In the Microsoft Dynamics NAV development environment. then the data for the second order is retrieved and formatted.rdlc. Describe How the Dataset is Generated Before you manually update the new RDLC report layout. On the File menu. Filename of the changed RDLC: <filename> Do you want to load the changes?” 13. Optimize the Dataset for the New Report Dataset Designer This lesson explains how to prepare to upgrade a report to Microsoft Dynamics NAV 2013. 11. you should analyze and understand the report. 15. you can determine the manual modifications that you must make to the new RDLC report layout. In the development environment. In the Save dialog box. A dialog box appears with the following message: “The layout of report id: '<report ID>' is changed by another application. on the File menu. select an empty line in Report Dataset Designer. click Layout to open Visual Studio Report Designer. Click Yes to load the changes. For a Classic report layout. the filtering can be managed in the development environment or in the Visual Studio Report Designer. and so on. Click the OK button to convert the report to RDLC 2008 format.Module 6: Upgrade Reports 9. Additionally. if you run an Order Confirmation report for multiple sales orders and the data for the first order is retrieved and formatted for the Classic report layout. Sometimes you can achieve the same result by using different functionality in the RDLC layout than in the Classic report layout. 10. the data for each data item is retrieved from the data item and it is formatted in the report sequentially. click Save. For example. you should understand how the dataset that contains the data that is displayed in the report is generated. More information about the generation of the dataset is available in the “Creating Reports” module. the report execution fails. or labels that are not related to another data item. title for a chart. such as the title of the report. For example. the field is added as a column in the dataset. Optimize the Dataset You must understand the dataset to understand the report and know how to debug it. the application will consume increased memory and then when memory is no longer available. Captions and Labels In reports that are upgraded from earlier versions of Microsoft Dynamics NAV 2013. To have the caption of a field. The fewer rows that are located in the dataset at run time. In the Microsoft Dynamics NAV 2013 Report Dataset Designer. 6-8 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . all data for the report is retrieved from the data item into one dataset. if you run an Order Confirmation report for multiple orders. such as the caption for a table field. When a report dataset grows. you can optimize the dataset by following these guidelines. especially when you upgrade a report. To avoid this scenario. translated into the user’s language at run time. Then the data is included in the RDLC layout. you can use labels instead. You can add labels that are related to another data item. the quicker the report will execute and fewer memory resources are consumed. Report performance is an important concept of report design. The Label Report Parameter figure shows an example. Optimizing the dataset of a report usually means minimizing the dataset. or a title for the report. The layout specifies that the data is grouped on pages according to the sales order number. Labels are passed as parameters to the report. the field captions are columns of the dataset.Reporting in Microsoft Dynamics® NAV 2013 For an RDLC report layout. then the data from all orders is merged into one dataset. If you do not include the caption in the dataset. you cannot change the language of the labels in the report. you can set the IncludeCaption property to Yes to specify that the caption for the field is also added to the dataset. then in a multilanguage application. then the IncludeCaption property is set to Yes for every child column of the data item. You design the dataset by using Report Dataset Designer. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6-9 . • There is a significant reduction in memory consumption when values are passed as report parameters instead of fields on each row.Module 6: Upgrade Reports FIGURE 6. if you want to use the Caption or CaptionML values of a field as a label on a report layout. If you set the IncludeCaption column of a data item. The following is a summary of captions and labels: • If there is a caption in the source expression. then consider using IncludeCaption instead. consider using a Label.5: LABEL REPORT PARAMETER Note: In Visual Studio Report Designer. You can set the IncludeCaption property in the Properties window of a data item or in the IncludeCaption column of Report Dataset Designer for a data item or a column. When you add table fields to the dataset with Report Dataset Designer. then you must include the caption in the dataset. • If there is a text constant in the source expression. Demonstration: Change the Size of the Windows Page File When a report is executed. Inventory Valuation” The Windows Page File The following demonstration will show how to set the size of the page file.microsoft. and its fields are not required for the dataset. When a BLOB field. consider using the DataItemTable view property of the data item to filter the data item. and aggregation is more efficient on the data source than during report processing.msdn.10 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . sort. If the dataset exceeds the memory Windows makes available. If the field is not used or not required to be available in the resultset. the dataset is sent from the Microsoft Dynamics NAV server into the memory on the server. by using properties or C/AL code. This reduces memory consumption and provides improved report execution.com/windowsdesktop/How-to-boost-performanceffb6c384 “How to boost performance on Dynamics NAV RTC reports: Report 1001. You can filter the integer dataitem in its DataItemTableView property by using this filter: WHERE(Number=CONST(1)) Avoid unnecessary rows in the result set If a data item is in the Report Dataset Designer for calculations only. However. it should be removed from the report dataset designer. then Windows will stop allocating additional memory and the client might stop responding. 6 . All report data regions in Visual Studio Report Designer can be used for filtering at run time.Reporting in Microsoft Dynamics® NAV 2013 Remove unused columns from the dataset A column in the report dataset designer will become a column in the result set that is generated at run time. If you cannot reduce the dataset. is required in the dataset it is recommended to use a separate integer data item to hold the BLOB field(s). Filter. Adding it to the report dataset can potentially increase the size of the dataset significantly. then the only alternative is to increase available memory on the server. for example the company logo. Apply the correct filters in the dataset Filters can be applied in the RDLC layout of a report. it will produce a smaller dataset and improve report execution performance. A good example of this technique can be found here: http://code. Avoid the usage of binary large object (BLOB) fields in the dataset A BLOB field can potentially contain 2gb of data. if the same result can be achieved by applying filters in the Report Dataset Designer. Select the Advanced tab. Demonstration Steps 1.Module 6: Upgrade Reports You can do this by physically adding more memory or by increasing the page file in Windows. Click “Settings…” in the “Performance” section. FIGURE 6.11 . Best Practice: Windows can handle the size of the page file for general Windows performance. b. The Virtual Memory window appears. then it recommended that you do this on a dedicated server that is used to print only large reports. e. Click Control Panel > System and Security > System > Advanced System Settings > Advanced. So if you do decide to increase the page file. d. Keep in mind that the Client is still a 32-bit application. a. Change the page file.6: CHANGE PAGE FILE Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . c. So interfering with this can cause problems for any other tasks that are running on that server. Click Change on the Virtual Memory section. and they will no longer have to invent a new appearance for each report. i. Changing the page file settings does not affect the performance of reports. and filtering expressions even if only top level data is visible. However. Now when you design a report. Report Design Guidelines In Microsoft Dynamics NAV 2013. g. Enter an initial size and a maximum size in the corresponding fields. sorting. the standard application uses new Report Design Guidelines. Select custom size. by doing this. If the user only wants to have detail data visible sometimes. 6 . the report processor must apply grouping. for reports. Optimize the Layout for RDLC 2008 This lesson explains how to redesign the layout to prepare for an upgrade to Microsoft Dynamics NAV 2013.12 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Although on-demand processing optimizes data evaluation by processing only visible data. other developers will be familiar with the appearance of the report. Note: Finding the correct values for the initial size and maximum size could require several tries. the client can receive more data before it runs out of memory. Additionally. Restart the server. More information about the Report Design Guidelines is available in the “Creating Reports” module of this course. This provides consistency to reports.Reporting in Microsoft Dynamics® NAV 2013 f. all data is part of the report. a drill down report is a better choice. Deselect the option: Automatically manage paging file size for all drives. Report Performance Optimization Tips Conditional visibility on a big dataset For report items with conditional visibility. the Report Design Guidelines will help you save time when you design reports. h. Some ways to combine data on a chart. It is recommended not to have more than seven or eight sections in a pie chart. Sum is not order-dependent and requires fewer resources. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . the number of group instances. are more effective with fewer data points. include the following: • When you use a pie chart. scatter graphs. without processing the rest of the report. and sort expressions are applied. the report processor assumes that any complex expression in the page header or footer might contain a direct or indirect reference to [&TotalPages]. Expressions in the Page Header or Footer Force All Pages To Be Processed When you include a reference to the built-in field [&TotalPages]. such as pie charts. the first page can be rendered and returned to the user immediately. • Filter unwanted or irrelevant data. Gauges are better suited in displaying a single value inside a cell. • When there are several data points. whereas other charts. Some charts." This reduces the number of sections on your pie chart. the report processor must paginate the whole report before it can render the first page. having more pixels on a monitor will decrease performance and the visual display of graphics. Typically. Consider the level of grouping. benefit from many data points. Previous is an 'expensive' aggregate function because its value depends on the sorted elements of a data region. This helps highlight the key data that you are trying to show on the chart. Therefore. If no reference to [&TotalPages] exists. and the aggregate functions that require being evaluated after group. Complex Tablix Data Region Grouping and Aggregate Functions Many levels of nested and adjacent groups in a Tablix data region can affect report processing performance. • If you want to add a bar graph to show ratio data in a table or matrix template. For example. merge small sections into one section called "Other. such as. filter. carefully select a chart type based on the values in your dataset and how you want this information to be shown. do not include a reference to [&TotalPages] or any complex expressions in the page header and page footer. To avoid having the report processor paginate a lengthy report. do not use data point labels. Data point labels are most effective when there are only a few points on the chart. Additionally. Other post-sort aggregates include First and Last.13 .Module 6: Upgrade Reports Best Practices when Displaying Data on a Chart Consider how much data is needed for a chart or gauge. consider using a linear gauge instead. Merged cells and unaligned report items interfere with Excel functionality in the exported report. For example. This value requires conditional processing.14 • For reports that have many instances of text boxes. render the report to a . and white space in a report. The KeepTogether feature requires additional processing when page breaks are calculated. each page break defines a new sheet in Excel. do not merge cells in a Tablix data region. • Set the KeepTogether property on Tablix members only when you must control the specific rendering behavior for a Tablix data region. For exporting to Excel. do not set the property TextAlign to General. column widths. depending on the text box content.Reporting in Microsoft Dynamics® NAV 2013 Reducing the data in the report might be sufficient to provide acceptable performance without changing any aggregate function calls. Each sheet can handle no more than 65000 rows. Design Tips for Better Report Processing For better report performance. set CanGrow and CanShrink on text boxes to FALSE. • For text boxes. you might have to modify the report design for a better viewing experience for the user. align report items vertically. • Do not use horizontal page breaks when they are not required. By default. If the primary format for viewing a report is a specific file format. each cell in a Tablix data region contains a text box so that the total number of text boxes that must be rendered can grow quickly. use the following information to help increase the time that is required to process your report: 6 . Review the margins. set AutoSize on images to a different value such as Fit. For example. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . • For reports that have many images. Report is Not Optimized for the Chosen Rendering Format Some features are not supported in all renderers. Consider these limits when you set the page breaks in a report.TIFF file and view it in the Microsoft Windows Picture and Fax viewer to determine whether additional pages are being rendered. In free form reports. In the Properties window. 1. 6. To identify hidden fields. under Layout. then the filter header is not displayed. Hide Nonfiltered Headers If you apply a filter to the data in a report. it is recommended that you insert a new row in the table and add the hidden text box to this new row. in the RDLC report layout.15 . 7. On the View menu.rdlc. click Save Report. you change the value of the Height property to a larger value so that you can view the row when you design the report. From the toolbox. under Font. set the Color property to Yellow. under Report Items. 10. on the Tools menu. 9. on the View menu. click Toolbox. set the Hidden property to True. If no filter is specified. and then set the Width property to a small width. 2. 3. under Position.Module 6: Upgrade Reports Add and Identify Hidden Fields If you have hidden fields on a report. Additionally. Note: If the hidden text box is in a table data region.15cm. On the File menu. However. such as 0. 8. 5. Next. click Object Designer. follow these steps. In the Properties window of the row. expand Size. under Visibility. On the View menu. and then click the Design button. it is recommended that you mark them so that they are easy to identify. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . click Layout. click the Properties window. such as 0. click Report. Select the text box that you created. In the development environment. In Visual Studio Report Designer. 4. In the Properties window. or select the yellow square from the drop-down list. You display this header row only if the user specifies a filter. select the report to which you want to add a hidden field. you might want to move hidden fields to a different location in the layout to avoid problems with formatting. drag a text box to the report layout.2cm. make sure that the value is not so large that it will cause formatting problems when you print the report. you must add a filter variable to the report dataset. In the Properties window. In Object Designer. create a conditional expression on the visibility of the filter header that uses the filter variable that you added to the dataset. then it is recommended that you create an additional header row in the report to display the filter. To conditionally display the filter header. Select the filter header text box. In Object Designer. select <Expression…> from the drop-down list.GETFILTERS. verify that Compiled is checked. click Report. For example. 9. In the Hidden field. 7. in the Report. add a text box to display the filter header.TRUE. 6 . In the C/AL Editor. select Layout. Customer/Item Sales.Value) = "". add code to obtain the filters. In the C/AL Globals window. In the Data Source field of the new line. In Report Dataset Designer. To hide non-filtered headers. click C/AL Globals. 13. on the Tools menu. In the Expression window. In Microsoft Visual Studio. if you have a filter on the Customer table and the filter variable that you created is named CustFilter. select Save. 14. In the development environment. and then on the View menu.16 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . select the report that you want to modify.TRUE. 10. In the Save dialog box.Reporting in Microsoft Dynamics® NAV 2013 An example of a report that uses additional header rows to display filter information is report 113. add a new variable for the filter.Value) = "". In the Properties window. 16. the following are the conditional statements for the two filter text boxes on report 113. On the View menu. select the Properties window. click C/AL Code. For example. 1. add a new line. 8. in the OnPreReport trigger. 11. CustFilter := Customer. under the DataItem for the table to which a filter can be applied. and then click Design. 5. 17. enter the name of the filter variable. then add the following code. 6. On the View menu. 3.FALSE) IIF(First(Fields!ItemLedgEntryFilter. select Column. The DataType of the variable is Text. 15. 12. On the View menu. On the File menu.rdlc file. expand the Visibility field. on the Variables tab. click Object Designer. Save and compile the report. follow these steps. 2. In the Data Type field of the new line.FALSE) 18. =IIF(First(Fields!CustFilter. and then click OK. create a conditional statement. 4. you must create the request page. open Report Dataset Designer. To access Request Options Page Designer. for every data item in the report. do not define any ReqFilterFields for the data item and set the DataItemTableView property to define sorting. However. By default. then users can select a sort field and sort order at run time. A request page runs before the report starts to execute. click View.17 . end-users cannot cancel the report run. You can design the filters on request pages by using the following report properties: • ReqFilterHeading • ReqFilterHeadingML • ReqFilterFields You can also select the following actions on a request page: • Print • Preview • Cancel • Help The fields that you define as ReqFilterFields are shown on the request page. You can use a request page to specify options and filters for a report. If you set UseReqPage to No. then the report starts to print as soon as it is run. The report can be canceled. Here. Best Practice: It is recommended that you add fields that the end-users of the report will frequently set filters on. a FastTab for defining filters and sorting is created on the request page. To remove a FastTab from a request page. You can design the Options FastTab of a request page by using Request Options Page Designer in the development environment. some pages might print. an end-user can add more fields on which to filter to the request page.Module 6: Upgrade Reports Build the Request Page After you upgrade the report to Microsoft Dynamics NAV 2013. and then select Request Page. Additionally.. If a DataItemTableView is not defined. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . The request page is displayed but there is no tab for this data item. Design your reports so that end-users cannot change the sort order in a way that affects the functionality of the report. to set up report usage logging. follow these steps. you must have a hotfix installed. the functionality can depend on a specific key and sort order. Determining which Reports to Upgrade This lesson will explain how to log report usage in Microsoft Dynamics NAV. A custom development could be an alternative to this solution.0: KB2575296 KB2575296 http://go. Code example OBJECT Table 50000 Report Log { OBJECT-PROPERTIES { Date=11-06-12. This only works in previous version(s) of Dynamics NAV.microsoft.microsoft.com/fwlink/?LinkId=267333 After you install the required hotfix. This information can be useful when you must determine which Classic reports should be transformed to RDLC reports.com/fwlink/?LinkId=267332 Dynamics NAV 2009: KB2558650 KB2558650 http://go. 1.Reporting in Microsoft Dynamics® NAV 2013 In a complex report that uses data from several tables. It can be downloaded here: Microsoft Dynamics NAV 5. Create new table to be used to log report usage. 6 . How to Log Report Usage You can use report usage logging to identify both frequently and rarely used reports in a customer installation. To log report usage.18 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Clustered=Yes } } FIELDGROUPS Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . CaptionML=ENU=User ID } { 3 .Integer . .User ID .No. MinValue=1 } { 2 .Module 6: Upgrade Reports Time=12:36:58. ."Object Caption" WHERE (Object Type=CONST(Report). Modified=Yes.No.Report ID .DateTime } } KEYS { { . Version List=NAV6.FieldClass=FlowField.Integer .Date Time .Text249 .Report Name . } PROPERTIES { } FIELDS { { 1 ."Role ID". Object ID=FIELD(Report ID))). . .AutoIncrement=Yes. . CaptionML=ENU=Report Name } { 5 .TableRelation="User Role".19 .CaptionML=ENU=Report ID } { 4 .Code50 . . . CalcFormula=Lookup(AllObjWithCaption. 3. Open C/AL Editor and browse to the end. Now run the Report Log table to view the result. ReportLog. ReportLog. Now open Locals and create the parameter= ReportId with Type=Integer. 11. Create a new function that uses the Name: OnReportRun. Now restart the Classic client. In OnReportRun write the following code: Code example ReportLog."User ID" := USERID. Now you must write the code for this new trigger. 5. } } 2. 9. 13.20 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Open Properties and change ID to 120.Reporting in Microsoft Dynamics® NAV 2013 { } CODE { BEGIN END. Run several reports. Open Codeunit 1.INSERT. Select the Variables tab and create a ReportLog. 8."Report ID" := ReportId. Browse to ”Functions”. 7. 10. ReportLog. 6. 6 . 4. 12. Open “C/AL Globals”."Date Time" := CURRENTDATETIME. click Object Designer. click Import. Import a Classic report. Task 2: Upgrade the Report High Level Steps 1.1: Redesigning a Customer List Report Scenario Simon is a Microsoft Certified Partner working for CRONUS International Ltd. click OK to open the Import worksheet to resolve any conflicts. c. Detailed Steps 1. and upgrades the report to be valid for Microsoft Dynamics NAV 2013. d. click Yes to confirm that you want to upgrade the report. b. This is the list that you imported in the previous step. Detailed Steps 1. click Report. In Object Designer. In the Import Objects window.fob). Simon uses the following procedure to import a Classic-only report and upgrade it. on the File menu. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . and then click Upgrade Reports. automatically creates an RDLC report layout. In Object Designer. select Report 101. He is asked to upgrade the Classic version of the Customer List report that CRONUS used in earlier versions of Microsoft Dynamics NAV. b. browse to the report object that contains only the Classic report layout (R101. and then click Open. Customer List. In the dialog window. on the Tools menu. If you are prompted. Exercise 1: Importing and Upgrading the Report Exercise Scenario Simon will upgrade the Classic report. Upgrade a Classic report.21 . In the development environment. This process deletes the request form. Then click OK in the Import Worksheet to import the report. Import a Classic report. a.Module 6: Upgrade Reports Lab 6. Task 1: Import the Report High Level Steps 1. Upgrade a Classic report. a. Open the report in Visual Studio Report Designer. In the Tools menu. in the Report. Exercise 2: Modifying the Customer List Report RDLC Layout Exercise Scenario Hidden fields in the RDLC report layout will cause formatting problems when Simon prints the report because these fields are outside the width of standard paper. click View. Detailed Steps 1. Task 2: Move the hidden fields High Level Steps 1. Task 1: Open the Report in Visual Studio Report Designer High Level Steps 1. click design. b. On the View menu. In Visual Studio. click the Properties window. Simon must move these hidden fields to another location on the report that is within the width of standard paper. Detailed Steps 1. Open the report in Visual Studio Report Designer. Move the hidden fields. e. c. select the following hidden fields on the right side of the table: =FIELDS!COMPANYNAME. Right-click the selected fields. click Compile to compile the report that you upgraded in the previous step.22 b. To eliminate the formatting problems.VALUE =FIELDS!Customer__ListCaption.Reporting in Microsoft Dynamics® NAV 2013 c.VALUE =FIELDS!CurrReport_PAGENOCaption. Move the hidden fields. select report 101. d. and then click Paste. Right-click the first field in the new row. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Right-click the row handle of the last row. and then click Cut.Value 6 . a. Visual Studio Report Designer opens. a. and then click Insert Row Below to insert a new row in the table. In Object Designer.rdlc file that is created. and then click Layout. in the Body section of the layout. and it will not cause formatting problems when you print the report.rdlc file. In Visual Studio. Task 3: Add the Functionality from the Section Trigger High Level Steps 1. This report has unsupported on the section trigger for Customer.Value) c.23 . click the Properties window. select the field at the top of the layout with the following value: =First(Fields!Customer_TABLECAPTION__________CustFilter. The height 0. You must add the functionality for this code elsewhere in the report so that it will run in Dynamics NAV 2013.False. in the Body section of the layout. In the Properties window. under Layout. Add the functionality from the section trigger. In the Report. g. Exercise 3: Add Captions and Labels to the Report Exercise Scenario In the upgraded report the captions are a part of the dataset. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . d. Mort will now optimize the report that has the property Include Caption and uses labels. Header (3). enter the following expression: =IIF(Fields!CustFilter. on the View menu. a.2 cm. Select the new row. Detailed Steps 1. change the value of the Height property to 0. Click OK.Module 6: Upgrade Reports f.Value<>"".2 cm is sufficient to view the row in the layout. This is because code in a section trigger is not supported and will not be migrated.True) e. select <Expression>. In the drop-down list for the Hidden field. Add the functionality from the section trigger. In the Expression window. b. 2. Detailed Steps 1. Enable the Include Caption property. a.Reporting in Microsoft Dynamics® NAV 2013 Task 1: Change the Captions of the Report High Level Steps 1. Enable the Include Caption property. b. In the Report Dataset Designer select the field that has the name Customer__No__ and then click Include Caption to enable it. 3. a. Remove the ‘old’ caption fields from the dataset. In Visual Studio Report Designer replace the old caption fields by using the new captions.24  In the Report Dataset Designer remove the following lines with the name:  Customer__No__Caption  Customer__Customer_Posting_Group_Caption  Customer__Customer_Disc__Group_Caption  Customer__Invoice_Disc__Code_Caption  Customer__Customer_Price_Group_Caption  Customer__Fin__Charge_Terms_Code_Caption  Customer__Payment_Terms_Code_Caption  Customer__Salesperson_Code_Caption  Customer__Currency_Code_Caption Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . 2. 6 . Repeat this step for the following fields: Customer__Customer_Posting_Group_  Customer__Customer_Disc__Group_  Customer__Invoice_Disc__Code_  Customer__Customer_Price_Group_  Customer__Fin__Charge_Terms_Code_  Customer__Payment_Terms_Code_  Customer__Salesperson_Code_  Customer__Currency_Code_  Customer__Credit_Limit__LCY__  Customer__Balance__LCY__  Customer_Contact  Customer__Phone_No__  Customer__Balance__LCY___Control42 Remove the ‘old’ caption fields from the dataset. In Visual Studio Report Designer change the expression of the text box that contains: =First(Fields!Total__LCY_Caption. In Visual Studio Report Designer. Add a label with the Name: Total__LCY_CaptionLbl and Caption: <Total (LCY)>. 2.Value ii.25 .Value Task 2: Use Labels in the Report High Level Steps 1. =Fields!Customer_ContactCaption. In Visual Studio Report Designer replace the old caption fields by using the new labels. c. right-click the text box that contains the expression: =First(Fields!Customer__No__Caption. Repeat this step for all text boxes in the first row of the label by using the corresponding parameter.  Customer__Credit_Limit__LCY__Caption  Customer__Balance__LCY__Caption  Customer_ContactCaption  Customer__Phone_No__Caption In Visual Studio Report Designer replace the old caption fields by using the new captions. 2.Value) and replace it with the following expression: Parameters!Customer__No__Caption.Value Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 .Value) to Parameters!Total__LCY_CaptionLbl. Detailed Steps 1. a. a.Value becomes =Parameters!Customer_ContactCaption. Repeat this step also the two textboxes on the first column containing the fields: i. =Fields!Customer__Phone_No__Caption.Value becomes =Parameters!Customer__Phone_No__Caption. in the first row of the table. In Visual Studio Report Designer replace the old caption fields by using the new labels. In the Report Label Designer add labels.Value b. a. Remove the corresponding line in the Report Dataset Designer. b.Module 6: Upgrade Reports 3. In the Report Label Designer add labels. select an empty line in Report Dataset Designer.Reporting in Microsoft Dynamics® NAV 2013 Exercise 4: Saving the RDLC Report Layout Exercise Scenario Simon must save the RDLC layout. Close Visual Studio. click Save report. b. In the Microsoft Dynamics NAV 2013 development environment. and he must also save and compile the changes in the Microsoft Dynamics NAV 2013 development environment. On the File menu. Close the report in Object Designer. Click Yes to load the changes that you made to the RDLC report layout. Task 1: Save the RDLC Layout High Level Steps 1. c. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In the Save dialog box.rdlc. click Save. Save the report. and then click OK. g.26 d. Save the report. You receive the following message: The layout of report id: '101' is changed by another application. on the File menu. f. select Compiled. In Visual Studio. a. Detailed Steps 1. Filename of the changed RDLC: <filename> Do you want to load the changes? 6 . e. Order Summary report that CRONUS used in the earlier version of Microsoft Dynamics NAV. In the development environment. This process will delete the request form. and upgrade the report to be valid for Microsoft Dynamics NAV 2013. Import a Classic report. If you are prompted. Task 1: Import and Upgrade a Classic Report High Level Steps 1.Module 6: Upgrade Reports Lab 6. Detailed Steps 1. b. on the File menu. automatically. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . In Object Designer. • Modify the RDLC report layout. Exercise 1: Importing and Upgrading the Report Exercise Scenario Simon will now upgrade the Classic report. a. • Save the layout and compile the report. on the Tools menu. Objectives • Import and upgrade a report that has only a Classic report layout to a Microsoft Dynamics NAV 2013 report that has an RDLC layout. click OK to open the Import worksheet to resolve any conflicts. click Object Designer. He is asked to upgrade the Classic version of the Customer . click Import. create an RDLC report layout. d. browse to the report object that contains only the Classic report layout for report R123456707. c. Import a Classic report. In the Import Objects window.Order Summary Report Scenario Simon is a Microsoft Certified Partner working for CRONUS International Ltd.2: Redesigning a Customer .27 . and then click Open. Customer Order Summary. In the Tools menu. click Yes to confirm that you want to upgrade the report. The “Customer – Order Summary Print Preview” illustration shows the RDLC report layout for report 123456707. Upgrade a Classic report. Customer Order Summary (this is the report that you imported in the previous step). Upgrade a Classic report. select Report 123456707. Detailed Steps 1. and then click Tools.28 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . In Object Designer. c. b. 6 . click Compile to compile the report that you upgraded in the previous step. click Report. after you upgrade the report but before you perform any manual modifications. a. Upgrade Reports. In the dialog window.Reporting in Microsoft Dynamics® NAV 2013 Task 2: Upgrade a Classic Report High Level Steps 1. Right-click the area in the table and then click Paste to paste the First(Fields!Outstanding_OrdersCaption. e. click Design. and then click Layout. Select the First(Fields!EmptyString. Select the first two rows of the table from which you cut fields. a. Select the First(Fields!Outstanding_OrdersCaption.Value) field.Order Summary Report RDLC Layout Exercise Scenario The RDLC report layout for the Customer Order Summary report that is created when Simon upgraded the report does not contain all the lines that are required to be displayed in the report. Right-click the area that is in the table. Open the report in Visual Studio Report Designer. in the Body of the report. under the text box in which you performed the previous past operation and then click Paste to paste the First(Fields!EmptyString. d. click View.rdlc file. c. Task 1: Open the Report in Visual Studio Report Designer High Level Steps 1. Open the report in Visual Studio Report Designer. Move header fields out of the table. Simon must make some modifications to the report layout.Value) field. Detailed Steps 1. select report 123456707.29 . right-click. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . Visual Studio Report Designer opens. move the table down in the layout to provide space for two fields in the table. and then select Delete Rows. and then click Cut. In Object Designer. and then select Cut. right-click the field. Move header fields out of the table. Task 2: Move Header Fields Out of the Table High Level Steps 1.Module 6: Upgrade Reports Exercise 2: Modifying the Customer . Right-click the row handle of the two rows.Value) value in a text box that is in the table. f. Detailed Steps 1. b.Value) value in a text box. b. a. In Visual Studio. Right-click the empty field in the first column of the second row of the table. The values in the hidden fields are as follows: =Fields!COMPANYNAME. i. and then click Paste. Although the fields are hidden. and then click Delete Columns. this causes problems with the print layout because of the width of the paper and the width of the table. Right-click the three columns. In Visual Studio. Select the three hidden fields on the third row of the table. c. g.Value) and =Sum(Fields!SalesAmtOnOrderLCY_4_. b. The first field is the SalesAmtOnOrderLCY_3_. and then click Cut. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . The other fields that can cause problems in the printed layout of the report are the three hidden fields.Value). white space is still allocated on the page for the fields. These hidden fields are in the rightmost columns of the table. on the last row of the table.30 h.Value =Fields!Customer__Order_SummaryCaption. This field is in the wrong location. In some cases.Value f.Reporting in Microsoft Dynamics® NAV 2013 The layout that is created automatically contains some fields that you must move. Update the layout. Update the layout. Select the last three columns of the table from which you cut the hidden fields.Value field. 6 .Value) fields. Expand the third row of the table. and then click Cut. e. Right-click the three hidden fields. a. right-click the field that uses the value =Sum(Fields!SalesAmtOnOrderLCY_3_. Right-click the empty field in the last row of the table that is between the =Sum(Fields!SalesAmtOnOrderLCY_2_.Value =Fields!CurrReport_PAGENOCaption. Decrease the width of the third column of the table. Detailed Steps 1. Note: It is recommended that you move these hidden fields from the right side of the table in all reports for which you create an RDLC report layout. and then click Paste to paste the three fields. d. Task 3: Update the Layout High Level Steps 1. Below. e. Use the request page to select if the values should be displayed in local currency (LCY) or in the company's own currency. The first detail line that you added in step 3 shows the values in the local currency. SalesOrderAmountLCY_Control36 To add these values. under Category. Add data to detail lines. Then select which values will be printed in the report that is based on the selection in the request page. select Fields (DataSet_Result). 2. SalesAmtOnOrderLCY_1_Control31 v. Click in the table to make it active. Detailed Steps 1. In the Expression window. follow these steps. d. Now set the visibility property. Add the grouping property for each detail row that you added. c. and then click Expression. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . Show the All Amounts are in the LCY caption only when the values are displayed in local currency. Task 4: Add Data to Detail Lines High Level Steps 1. SalesAmtOnOrderLCY_5_Control35 ix. 4. you must add a conditional statement to the visibility property. 5.Module 6: Upgrade Reports The next step is to add detail lines and add data to those lines in the table so that the same information that is in the Classic client report layout is in the RDLC report layout. by adding a grouping property. and then click Insert Row > Inside Group . Right-click the field of the detail line. Obtain the sum of the lines in the dataset for each customer. SalesAmtOnOrderLCY_2_Control32 vi. The second detail line shows the values in the company's currency.31 . Customer_No_ ii. iv. Right-click the blank detail row. 3. Add data to detail lines. Add the following values to the first blank detail line: i. a. b. SalesAmtOnOrderLCY_4_Control34 viii. Leave the third column blank. Customer_Name iii. Show the customer filter caption only when a customer filter is applied. SalesAmtOnOrderLCY_3_Control33 vii. 6 . SalesAmtOnOrder_3_ vii. by adding a grouping property. For example. j. select SalesAmtOnOrderLCY_1_Control31Format.Reporting in Microsoft Dynamics® NAV 2013 f. select the Format value of the field that you selected. For each value. For each amount value. change the expression to Sum(<expression>). the data that is shown must be the sum of the lines in the dataset. enter 7pt. An expression is added to the text box. k. Under Fields. follow these steps. a. Customer_Name iii. and then click Properties. SalesAmtOnOrder_1_ v. m. Add the grouping property for each detail row that you added.Value to =Sum(Fields!SalesAmtOnOrderLCY_1_Control31. For example.Value) i. In the Textbox Properties window. g. Select the row. you must modify the font and the format. Right-click the field. q. under Category. In the Row Groups window.32 Obtain the sum of the lines in the dataset for each customer. Customer_No_ ii. SalesAmtOnOrder_5_ ix. h. change =Fields!SalesAmtOnOrderLCY_1_Control31. click the Number tab. b. Sales_Line__Currency_Code_ iv. Add the following values to the second blank detail line: i. select Fields (DataSet_Result). In the Expression window. p. click Custom in Category and next to Custom format. SalesOrderAmount 2. SalesAmtOnOrder_2_ vi. s. double-click the value from the previous list. SalesAmtOnOrder_4_ viii. To create the sum. In the Text box Properties window. n. o. click the Expression button. Click OK. select Group Properties. Under Size. l. click the Font tab. Under Field. Click OK. If the field is an amount field. To format the data. r. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . e. This row does not have the LCY values.Value). and then click OK. select <Expression>. Now set the visibility property.Value is not true: = not first(Fields!PrintAmountsInLCY. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . Show the All Amounts are in the LCY caption only when the values are displayed in local currency. select <Expression>. In the Properties window. a. and then enter the following expression in the text box: =not First(Fields!PrintAmountsInLCY. In the Properties window. you must add a conditional statement to the visibility property.33 .Value) d. Select the first of the two rows that you added. d. expand Visibility. Select the second of the two rows that you added. Then select which values will be printed in the report that is based on the selection in the request page. b. Use the request page to select if the values should be displayed in local currency (LCY) or in the company's own currency. b.Value) 4. change the expression to the following so that the row is hidden if Fields!PrintAmountsInLCY. c. The second detail line shows the values in the company's currency.Module 6: Upgrade Reports 3. f. and then select Properties. a. Right-click the field =First(Fields!All_Amounts_are_in_LCYCaption. In the Group on field select Fields!Customer_No_. Click OK. expand Visibility. In the drop-down list for Hidden. In the Expression window. change the expression to the following: =first(Fields!PrintAmountsInLCY.Value) c. select Expression. The first detail line that you added in step 3 shows the values in the local currency. In the drop-down list for Hidden. c. Under Initial visibility. click the Add button. This row has the LCY values. In the Expression window. d. In the Properties window. In the Textbox Properties window.Value. click the Visibility tab. Value. In the Textbox Properties window. g. Right-click the field =First(Fields!Customer_TABLECAPTION__________CustFilter. b. f. Filename of the changed RDLC: <filename> Do you want to load the changes? 6 .rdlc. You receive the following message: The layout of report id: '123456707' is changed by another application. Show the customer filter caption only when a customer filter is applied. select Expression. Task 1: Save the Report High Level Steps 1.Va lue). In the Save window. On the File menu. Save the report. "DataSet_Result")= "" Exercise 3: Saving the RDLC Report Layout Exercise Scenario Simon must now save the RDLC report layout. a. click Save report. click the Visibility tab. c. and he must also save and compile the changes in the Microsoft Dynamics NAV 2013 development environment. select an empty line in the report in Object Designer. c. Detailed Steps 1. a. select the Compiled check box. In the Microsoft Dynamics NAV 2013 development environment. and then click Properties. In Visual Studio. Under Initial visibility. click Save. Save the report. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . Close the report in Object Designer. Close Visual Studio. and then click OK.34 d. and then enter the following expression in the text box: =First(Fields!CustFilter.Reporting in Microsoft Dynamics® NAV 2013 5. Click Yes to load the changes that you made to the RDLC report layout. e. b. on the File menu. Module 6: Upgrade Reports Module Review Module Review and Takeaways This module described the upgrade process for different report types: • A Hybrid Report • A Processing Only Report • A Classic Report Furthermore several tips.35 . 1. tricks and recommendations were provided concerning performance and optimization of the dataset and report layout. Which report types cannot be upgraded to Microsoft Dynamics NAV 2013? ( ) Classic ( ) Hybrid ( ) Textual ( ) ProcessingOnly 2. The module also covered how to determine which reports to upgrade and concluded with practical labs and real life examples on how a List report and an Order Summary report should be upgraded. Test Your Knowledge Test your knowledge with the following questions. Which menu item is used to upgrade a report to the Microsoft Dynamics NAV 2013 RoleTailored client? ( ) Tools > Upgrade Reports ( ) Tools > Report Upgrade ( ) View > Layout ( ) View > Upgrade Report Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . How is report usage logged in Microsoft Dynamics NAV? ( ) Report usage is logged automatically.36 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement . ( ) A hotfix must be installed . depending on the version of Microsoft Dynamics NAV. 6 .Reporting in Microsoft Dynamics® NAV 2013 3. after which you can create a log table and modify a Codeunit 1. ( ) Report usage cannot be logged in Microsoft Dynamics NAV. ( ) Report usage is logged through the change log functionality. depending on the version of Microsoft Dynamics NAV.37 . How is report usage logged in Microsoft Dynamics NAV? ( ) Report usage is logged automatically. ( ) Report usage cannot be logged in Microsoft Dynamics NAV Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement 6 . Which menu item is used to upgrade a report to the Microsoft Dynamics NAV 2013 RoleTailored client? (√) Tools > Upgrade Reports ( ) Tools > Report Upgrade ( ) View > Layout ( ) View > Upgrade Report 3. after which you can create a log table and modify a Codeunit 1. ( ) Report usage is logged through the change log functionality.Module 6: Upgrade Reports Test Your Knowledge Solutions Module Review and Takeaways 1. (√) A hotfix must be installed . Which report types cannot be upgraded to Microsoft Dynamics NAV 2013? ( ) Classic ( ) Hybrid (√) Textual ( ) ProcessingOnly 2. Reporting in Microsoft Dynamics® NAV 2013 6 .38 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement .
Copyright © 2024 DOKUMEN.SITE Inc.