All About Reports: An Inside Look Into Report Extensions

Jared Drueco | May 23, 2022

This past week I’ve been finishing up a client’s customized sales invoice report. Meetings consisted of getting client feedback on my first report draft. Internal quality control was performed to ensure all requirements for the report were met. I’ve learned quite a bit from creating these extensions, and I thought of sharing my findings on here!

Anatomy of a Report

The structure of a report is as follows: a report’s dataset contains data items, and data items hold columns that can show field values from Microsoft Dynamics 365 Business Central (“Business Central”) input. There are already multiple “default” reports in Business Central, so the purpose of a report extension is to add more components to a report’s dataset.

We can view definitions for reports, data items, and columns in our extension by hovering over variables. This also gives us the ability to see the component in the default report:

The above snippet already has the “Allow line Disc.” in the Header data item so we were able to add that field directly. Usually we will want to extract field data from a different table/page we created; this field will not be available in the current data item so changes must be made to the Header.

This code snippet will get a field from a different table and adds it to the data item “Header” so that it can be displayed on the report. Here, the get() command will make all fields from a table record available for us to use. The primary keys of the table must be included in the parameters of the get() command. I used a simple if-statement to ensure there is at least some value to pass into the column field, otherwise an error will occur if no data is passed.

Report Designers

Now that we know how to added more fields to extract data from, we need to use a report designer to actually edit and display this data. There are two main report designers used to accomplish this: Microsoft Office Word to edit .docx reports and an RDLC report builder to edit .rdl or .rdlc reports (SQL Server Report Services).

After trying out both designers, I’ve concluded that an RDLC report designer is a better choice for most developers. Although .docx reports are easier to view in emails and previews, an SSRS makes it easier to implement more functionality within a report. For example, one of my report’s requirements was to to apply conditional image rendering based on a fields value. There is no easy way of doing this in Word, but when working with a SSRS one can simply give an image a visibility property and expression.