Designing reports in NAV2009 is divided into the following parts:
Defining the data model
The first step is to define the data model for the report. This is done using the Classic client option in NAV.
To define the data model, perform the following steps:
1. Open Object Designer from the Classic client by using the function key F12 or from the Tools menu.
2. In Object Designer, click Report and then click the New button to open the new report.
3. In the Table
field, click the drop-down arrow, and then select the table. In this
example, we will design a report that shows the quantity of items sold
to a customer. Therefore, choose the location table in the Table List
window.
4. Select the Create a Blank report option. If we are designing a simple list or a form-type report, we can choose the Create using Wizard
option. The wizard will guide us through the steps of choosing fields,
which will automatically be placed on the report. In this example, we
will design the layout using Visual Studio for the report to run using
the RTC client, and hence we will go with the option of creating a blank
report. Click on OK.
5.
At this point, it is preferable to save the report and assign it an
Object ID before designing it further. Close the report. Say Yes to the message for saving the report. The system will ask for an object ID and name for the report.
6. Assign an object ID and name for the report. This creates and saves the report.
7. Now go to the saved report by selecting the report from the list in the Object Designer and click on Design.
8. In the Data Item screen, select two tables in the two rows.
After the tables have been selected, we will now define relationships between these tables.
Defining relationships between tables
As we need to report on items sold by the customer, the items list should be grouped by customer.
1. Use the arrow buttons at the bottom-right of the screen to define levels of tables. The level for Item table should be 2. Use the right arrow button once to define this level for the Item table.
2. Pointing the cursor to a new line, select Sections from the View menu.
3. Use the Field Menu button to see the list of fields. Selecting the section Location, choose the fields Code and Name from the menu and drop them on the Customer section.
4. Similarly, add a few fields in the Item section. We will select the Quantity on hand and No. fields in this example.
5. Add a label control with the caption Items by Location on the top-left corner of the Location body.
Defining the relationship between the tables
As we're using two tables in
this report and need to report on a common field in the two tables, it's
important to define the relationship between the two. To define the
relationship, select the data item Item, open its properties and set the property DataItemLink to Location Filter=FIELD(Code).
Now, as we have defined the data model and the relationships between the table, the next step is to define the layout.
Defining the layout
We need to do this in Visual Studio, which can be instantiated from the NAV report by clicking Layout in the View menu.
As shown in the
preceding screenshot, the dataset in the report layout in Visual Studio
should include all the fields and captions we defined in the classic
design.
Selecting the matrix
We need to follow the steps given next to select the matrix:
1. Click on Toolbox and select a Matrix box for the layout.
2. Place the Items by Location caption in the top-left cell of the matrix.
3. To insert a row, add a group in the Rows section of the layout. Right-click the Rows cell and click Insert group. In the expression area, select the field as shown in the following screenshot: Item_No_.Value
4. To add the Warehouse column above the data (No. of items), add "=Fields!Location_Name.Value" in the Columns area.
5. To add the data, drag the Item_Inventory field to the data area.
The Sum(Fields!Item_Inventory.Value) is automatically added.
6. Add the columns in the cells by setting the BorderStyle property to Solid.
7. Our report should like the following screenshot:
8. Save and close the report.
Testing the report
Now, as the report design is
complete, the next step is to test the newly created report. We will
start by saving the report first.
To test the report, we can add the report in the main page or can run it directly using the following command and parameters:
"dynamicsnav:// [machine name] /DynamicsNAV/ [company name] /runreport?report=50030"
Consider the following example:
" dynamicsnav://localhost/DynamicsNAV/CRONUS International Ltd./runreport?report=50030"
The report output should look like this:
Dynamics NAV provides us
with powerful tools and features to gain control and give us a crisp
insight into our business. Future versions of NAV will see more Business
Intelligence enhancements in the product such as stronger integration
with SharePoint, PowerPivot integration, and more use of MS Office
products with NAV.