In Microsoft Dynamics NAV, reports are used for printing information from the database, and to execute batch jobs (process information in batches). Our focus will stay with the printing part of this definition. Modifying batch jobs requires a lot of programming knowledge, so our story about them ends here.
Even though reports are traditionally seen as objects used to print data, reports in Microsoft Dynamics NAV 2009 provide a more versatile functionality: they can print information, process it, or do both simultaneously; or they can present data on screen, or export it to Excel or PDF.
To better understand how to create and modify reports in Microsoft Dynamics NAV 2009, we need to do some theory (with a bit of practice as we go).
Reporting in previous versions of Microsoft Dynamics NAV, as well as in 2009’s Classic client uses technology based on C/SIDE objects called Reports.
Creating simple reports is a fairly simple task—all you need to do is click New in the Object Designer within the Reports view, then the New Report wizard takes over.
You need to specify the table over which the report will be based, and then decide whether you are in the mood to draw the layout yourself, or you want to have the wizard do the legwork on your behalf. There are three types of layouts the wizard can create:
When you specify which table you want to use as your base and make your pick about the report type, clicking the OK button will launch the wizard for the report of the chosen type. Each of the types has its own wizard with a different set of questions asked and steps to follow.
A report consists of data set definition, report layout, and options page. Now, being proprietary all the way home, all of the folowing three use specific terminology:
Reports need to be connected to some data, which resides in tables. Data items are tables we decided to use in our reports. Data items are also the first thing we see after the New Report wizard has completed its chore. A typical data item looks like the following:
You can add as many data items as you need. To add a data item, position the cursor on the first empty line, and start typing the table name (or number) in the DataItem field. Alternatively, you may position the cursor on an existing data item line, then press F3 (or choose New from the Edit menu). This will insert a new line just before the line you selected.
When the report is run, data items are executed in sequence, meaning that all the records from the first data item will be processed (and inserted into the report) before the report moves on to the next data item. In most cases, this is not how you want it to be.
Data items come with a concept of indenting. By the clicking left and right arrows you can indent a data item to the left or right. This can help establishing a parent-child (or master-detail) relationship between data items, meaning that for each parent (or master) record all its child (or detail) records will be processed before the report moves on to the next master record.
Indenting alone has not yet established the parent-child relationship. It has achieved only one thing: it will make the report execute all child records for each of the parent records. To complete the relationship setup, we need to set some data item properties:
The most important property is DataItemLink, and we can type in the link setup manually, or we can invoke the DataItem Link editor by pressing F6 or clicking the Assist button. It will open the DataItem Link editor, which is used to establish the mapping between the fields in the child table (Field column) to the equivalent fields in the parent table (Reference Field column).
Other than indenting, data items can accomplish a few other things as well, so you will frequently use these properties as well:
Data items simply define where the data comes from and what kind of relationships exist between different tables; sections define how this data is going to be laid out on the report. Section Designer is where you do this, and you can invoke it by clicking Sections in the View menu.
You’ll immediately see that it’s no state-of-the-art editor, but it accomplishes its purpose. The folowing is what a typical Section Designer will look like:
When you create your report using the wizard, it will create several sections for you, depending on the report type and choices you made. For every data item that you add manually, one section is inserted. A section is a part of a report with specific behavior. This behavior is embedded in the section type, and to see which section types there are, simply press F3, or select New from the Edit menu:
This is what they do:
In Section Designer, each section is represented by a gray horizontal bar which goes all the way across the screen, and carries a label, such as Sales Header, Body (1). This label is actually an identifier: Sales Header is the name of the data item, Body is the section type, and the number in parentheses is the ordinal number of the section for that data item. If there are several sections for the same data item, they will all be numbered consecutively starting at 1.
I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…
Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…
Once we learn how to deploy an Ubuntu server, how to manage users, and how…
Key-takeaways: Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…
While developing a web application, or setting dynamic pages and meta tags we need to deal with…
Software architecture is one of the most discussed topics in the software industry today, and…