Report components in NAV 2009: Part 2

0
92
6 min read

Data item Sections

Earlier in our discussion on reports, we referred to the primary components of a report. The Triggers and Properties we have reviewed so far are the data processing components. Next in the report processing sequence are Sections. In Classic RD reports, Sections are the output layout and formatting components. In RTC reports, Sections have a much more limited, but still critically important, role.

In the process of creating the initial report design, you may be entering data either completely manually as we’ve done in our example work, or you may use the Classic Report Wizard. If you use the Wizard, you will end up with Sections defined suitable for Classic Client Report processing.

Those Sections may be only rough draft equivalents of what you may want your final report to look like, but they are a suitable starting place for the Classic RD layout work, if that were the tool you were going to use. If you are creating your report completely manually, that is by not using the Wizard, you may also find it appropriate to define Sections to the point that the Classic Client could print a basic, readable report.

In our case, we are focusing our production report development effort on the RoleTailored Client, so we will invest minimal effort on Classic Client compatible report layouts. We might do just enough to allow test report runs for data examination purposes and logic flow debugging. However, creating basic Section layouts provides us with another benefit relative to our VS RD layout work, especially if we can create them using the Report Wizard, because all the fields to be used by VS RD must be specified in the Sections.

Creating RTC reports via the Classic Report Wizard

Let’s look at the RTC report development flow again. The preceding image is very similar to the one we studied earlier in this articles, but this flowchart only shows the steps that are pertinent to VS RD.

Programming Microsoft Dynamics NAV 2009

In Step 6 of this flow, there is an option to Create Layout Suggestion in the Visual Studio Report Designer as shown in the following screenshot:

Programming Microsoft Dynamics NAV 2009

When you choose Create Layout Suggestion, the C/SIDE Report Designer will invoke a process that transforms the layout in Sections to a layout in the Visual Studio Report Designer. If a VS RD layout previously existed, the newly created layout will overwrite it. Therefore, this option will normally be used only once, in the initial stages of report design.

Let’s experiment by using the Report Wizard to create a simple report listing the gifts received by ICAN. We will access the Report Wizard in the Object Designer. Click on Reports | New, then fill in the Wizard screen as shown in the following image.

Programming Microsoft Dynamics NAV 2009

Then click on OK and choose fields to display in the report as shown in the following screenshot.

Programming Microsoft Dynamics NAV 2009

Click on Next, then choose the sorting order (that is index or key) that starts with Donor ID. Click on Next again and choose to Group the data by Donor ID. Click on Next again and choose to create totals for the Estimated Value field. One more, click on Next and choose the List Style for the report, then click on Finish. At this point, you will have generated a Classic Client report using the Report Wizard. If you View | Sections, you should see a C/SIDE report layout that looks much like the following screenshot.

Programming Microsoft Dynamics NAV 2009

Let’s save our newly generated report so that, if we need to, we can come back to this point as a checkpoint. Click on File | Save As and assign the report to ID 50002 with the Name of Gifts by Donor.

Now click on Tools | Create Layout Suggestion. The process of transforming the Classic Report Layout to a Visual Studio Report Designer Layout will take a few seconds. When the report layout transformation process completes, you should see a screen that looks very similar to the following screenshot.

Programming Microsoft Dynamics NAV 2009

The primary data layout portion of the same VS RD screen is shown in the next image.

Programming Microsoft Dynamics NAV 2009

Compare this to the Classic RD data layout we just looked at a couple of steps ago. You will see some similarities and some considerable differences.

Without doing anything else, let’s save the VS RD layout we just created for the RoleTailored Client, then run both versions of the report to see the differences in the generated results. To save the VS RD layout, start by simply exiting the VS Report Designer. Once the VS RD screen closes, you will see the following question.

Programming Microsoft Dynamics NAV 2009

Respond by clicking Yes. Then, when you exit the Classic Report Designer, you will see this question.

Programming Microsoft Dynamics NAV 2009

Respond by clicking Yes. You will then be presented with the following message.

Programming Microsoft Dynamics NAV 2009

Again, click on Yes. If there were an error in the RDLC created within the VS RD (such as an incorrect variable name used), an error message similar to the following would display.

Programming Microsoft Dynamics NAV 2009

Since, hopefully, we didn’t get such an error message, we can proceed to test both the Classic Client and the RoleTailored Client versions of our generated report.

We can test the Classic Client (or C/SIDE RD) version of Report 50002 from the same Object Designer screen where we did our initial design work. Highlight the line for Report 50002 and click on the Run button. You should see the following screen:

Programming Microsoft Dynamics NAV 2009

If we were running this as users, we might want to make a selection of specific Donors here on which to report. As we are just testing, simply click on Preview to see our report onscreen. The report will then appear, looking like the following:

Programming Microsoft Dynamics NAV 2009

As you can see, with minimum development effort (and a minimum of technical knowledge), we have designed and created a report listing Gifts by Donor with subtotals by Donor. The report has proper page and column headings. Not only that, but the report was initiated withs a Request Form allowing application of filters.

Close the Classic Client report; now let’s run the RTC version. Just like we could do with Pages, we will run our Report test from the Windows Run option. Click on Run and enter the command to run Report 50002, as shown in the next screenshot.

Programming Microsoft Dynamics NAV 2009

Click on OK. If the RoleTailored Client is not active, after a short pause, it will be activated. Then the Request Page will appear. Compare the look and contents of this Request Page with the one we saw previously for the Classic Client.

Programming Microsoft Dynamics NAV 2009

As before, click on Preview and view the report. Of course, this time we’re looking at the RTC version.

Programming Microsoft Dynamics NAV 2009

This method of automatic transformation is very useful for getting an initial base for a new report or, obviously, for the complete generation process for a simple report where the requirements for layout are not too restrictive.

LEAVE A REPLY

Please enter your comment!
Please enter your name here