Bootcamp Notes: Reporting

Here I am again with the last post of my bootcamp notes. You will notice a lot of changes have taken place, going from design in the development client to new RDLC functionality.

Development Environment
The most obvious change will be the difference in the DataItems. If you worked with Queries in NAV, you might see the resemblance. Instead of just selecting DataItems and indenting them, you also specify the “Columns” you wish in the report here as well. No more messing around with sections.

A new option in the menu is to create labels. These are basically text constants you can send to RDLC without them being in your Dataset (Set the CaptionML through the properties of the label). These are sent as parameters. So are the captions of your Columns. Doing this will certainly decrease the size of your Dataset. After every column, you can select to “Include Caption”, but there is no option to change the caption on a column. If you need a specific caption, you must either create a label or a separate field holding the caption.

So, when to create a label and when to create a field? Basically, if you can, create a label or use the “IncludeCaption” property. Using a field will just put it in the Dataset and thus increase the size of your Dataset. There are a few place where you would actually want to do this, like in a report to print documents which need to be in the language of the receiver (Invoices, Cr. Memos, …). You will notice Report 206 using FIELDCAPTION(<field>) instead of the property here as well.

When you add a column by using the AssistEdit or fill it manually, the name is not set automatically. This is only done when you select fields from the field list. They are named <fieldname>_<tablename> by default then.

The reports still have triggers and can still be ran as a Processing Only report.

Visual Studio Environment
Compared to NAV2009 there have been a lot of modifications, not only behind the screens. As mentioned are the Datasets completely different by using the Parameters, but designing has become a lot different as well. We used to see a difference between the header, body and footer which now became only a small line you cross.

I actually have a pretty long list of changes and improvements, but I’ll try to just list them first and take out the most important ones afterwards. If you still have questions, drop a comment below.

– Every time you open VS, you need to click “View – Report Data” to get the list of fields on the left side
– RC (Right Click) on body to add an object to the report (Textbox, Rectangle, …)- RC on the body – insert to add PageHeader or PageFooter
– In a table, it is better to delete the value of it before dropping a new one in, most likely it would append the expression otherwise.
– A table field has a button to quickly select the field to show in it
– No need to add columns separately, you can drag a field from your report data to automatically create a new column (shows a blue line)
– All objects “snap” to the position of other objects when moving or resizing them (just like in Visual Studio)
– Tablix is a new object type. It is a merge of Table, Matrix and list. You can afterwards still change the type of a list to a matrix
– RC any field, object, … to see more contextual options such as properties
– “Build” the report in VS to see the errors immediately (also possible in NAV2009)
– Print Preview depends on the installed printer, think about this when testing reports
– Refresh Dataset without closing and reopening VS. Remember that captions are not in the Dataset and you still need to reopen VS.
– Print Preview will always work, even when checking for print preview in code.
– Set expressions for font, color, …
– You can use Me.Value in any expression field to check the field value instead of adding the reference to the correct field itself (eg. use it in the visible property)
– Expressions are shown as Expr
– Nested Data Regions are possible (Table in a table), but not supported for export to excel
– Reference aggregates of your fields in the header directly (FIRST, LAST, SUM, …)
– SetData is still needed in some cases, NAV now puts this in the visible property by default
– Images are called with First property if possible, otherwise, still need for Textboxes in the top of the body
– Create a new VS project and add the ReportViewer addin to make reports standalone
– Add images to Report Data – Images to use embedded images
– Possible to set a background image to a report (eg. watermark)
– You can use HTML code in a textbox, change the property of the placeholder in your textbox for this. Not all tags are supported though
– Add URLs to fields through placeholder properties
– Format through property are better, you can set any custom format as described in MSDN. Avoid Currency format, it will add system currency code instead of the currency code you wish
– Better page break options: before, after and between each instance
– Document Map: On a textbox you can set the Document Map Expression which will actually create a document map for that (even when generating PDF)
– Page Size is selectable from a list, but can still be specified

Since tables, matrixes and lists have been replaced by the Tablix control, there have been some other changes in the way it works as well. Settings groups is now done below your designer. Not only can you add totals, parent and child groups before (which is new) and after the group, you can also make an adjacent group which basically is a group at the same level of your selected group. Column group can only be created in a matrix.

You can drag fields to the group list to create the groups automatically, but adding a group by right clicking, you can add a group header or footer, which you cannot do afterwards… Group header data can now also be on the same level as the DataRows, and group expressions can be variable.

Creating a matrix has a lot of the look and feel as Pivot tables in Excel.

Considerations for rendering to PDF, Excel and Word
– Every page break becomes a new sheet, it is not possible to change the sheet names
– Background images are not supported and thus not exported
– Footer is not taken over to Excel
– No nested containers supported, except for lists containing table/matrix
– Charts are rendered as pictures, not as an Excel Chart- Rectangles are changed to a group of cells
– Excel renders fields by merging cells so it should look almost the same as your preview, try to align fields as much as possible to avoid to much merged cells. The alignment snap is pretty convenient for this.

– Fonts are not included
– Document maps are rendered as PDF bookmarks, all of the are on the same level

– Maximum 63 columns supported!
– Maximum 22″ wide and high
– Ignores Page Header & footer height
– Word re-paginates

Optimisations and Considerations
When you have set the size, make sure the interactive size is also set, better to always copy this. Otherwise it could result in extra white margin which prints extra white pages.

– Remember the CanGrow and CanShrink properties (see Excel rendering)
– Set the AutoSize property of an image not to Fit if possible
– Avoid Horizontal Page Breaks (see Excel rendering)
– Always review margins, widths and white spaces
– Change TextAlign if possible. General option uses conditions and can slow down report generation if there are a lot of textboxes.

When you try to optimize your Dataset remember the following points:
– Only use captions if you need them, that is why they are not enabled by default
– Use labels if possible, they are only sent 1 time
– Remove unused columns
– Avoid blobs
– Avoid unnecessary rows
– Apply correct filters (see here)

Most of reporting is comparable to NAV2009 actually, there are few changes, but don’t let yourself be scared, it might actually become easier to create reports. And who knows which improvements the next version of NAV might bring.
I know that maybe I did not go too deep into the reporting, but by opening a standard NAV report and looping through my list might show you more clearly what I mentioned.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.