How Do I : Create a Document Report, and layout, in VSCode? (part2)

Here I’m again, ready to continue this post (http://thinkaboutit.be/2019/01/how-do-i-create-a-document-report-and-layout-in-vscode-part1).

At this moment we have a dataset that fetches information from two tables: a header and a line, that are joined together via the DataItemLink and PrintOnlyIfDetail properties. Now it’s time to add a layout.

Now, a report can have none, one, or multiple layouts.

Using the ProcessingOnly report property, you can say that the report does not have a layout, and will only execute the AL-code in the triggers of the report and the dataitems. Furthermore, the request page will not display a Print or Preview button, but only an Ok and Cancel button:

We will add a layout to the report, and so ProcessingOnly is False, which is the default.

Then a report can have a built-inn layout and run time layouts. Built-In  you can add 1 RDLC and/or 1 WORD layout. You reference them in the properties:

  • RDLCLayout
  • WORDLayout

The property DefaultLayout then determines which one is the default. If not specified it will be the RDLC layout.

To get started, let’s create an RDLC layout:

  • RDLCLayout = ‘MyDocumentReport.rdlc’;
The layout can also be put/generated in another folder. The RDLCLayout property can contain a patch, relative to the root of your project.
Right click the layout, and select Open Externally:
The report layout opens in Visual Studio:

You can also use Report Builder. Actually, I have configured my machine so that when the reports ends on .rdl it opens in Report Builder and when it ends on .rdlc it opens in Visual Studio. I will go deeper into this in a separate blog post (later).

In Visual Studio, you can see the dataset on the left side, the body in the middle and the properties at the right side.

I would like to add a table to the body, to display fields from the header and line tables. BUT: I would like to see the line fields, per header record. That means I will need to add a group to my table. In fact, I will group the Line record by the Document No.

When you want to add a group to a Table, my recommendation is to first create the table with the fields that need to be grouped.

So in this case:

Then, add the group:

Now add the fields from the Header table to the right of the Document No:

Now, let’s test this. Save the layout in Visual Studio and Close or Minimize it. Then build the project in VSCode:

As you can see, the Headers print, with their corresponding Lines.

Now let’s put every document on a separate page.

To do that we need to add a page break after every document, or to be more specific, enable a page break in the group on Document No:

And when you run the report again, you see that every document is on a separate page:

Alright.

We have progressed one step further in the development of our document report. In the next blog post I will enhance the layout and also create a WORD layout. See you soon…

Comment List
Related
Recommended