Reader small image

You're reading from  Mastering Microsoft Dynamics 365 Business Central

Product typeBook
Published inDec 2019
PublisherPackt
ISBN-139781789951257
Edition1st Edition
Right arrow
Authors (2):
Stefano Demiliani
Stefano Demiliani
author image
Stefano Demiliani

Stefano Demiliani is a Microsoft MVP on Business Applications and Azure, MCT, Microsoft Certified Solution Developer (MCSD), Azure Certified Architect, and an expert in other Microsoft related technologies. His main activity is architecting and developing enterprise solutions based on the entire stack of Microsoft technologies (mainly focused on ERP and serverless applications). He has worked with Packt Publishing on many IT books related to Azure cloud applications and Dynamics 365 Business Central and is a frequent speaker at IT conferences around Europe. In his free time Stefano is also a runner and a cyclist.
Read more about Stefano Demiliani

Duilio Tacconi
Duilio Tacconi
author image
Duilio Tacconi

Duilio Tacconi is a Microsoft Dynamics NAV/Microsoft Dynamics 365 Business Central Escalation Engineer at Microsoft EMEA Customer Support & Services (CSS). He joined Microsoft in 2008 after working in a customer IT department with a focus on system administration and development. Despite graduating with the highest score in Agricultural Science in 1996, he is in the ERP circuit since 1998 as developer and system implementer for several companies with Microsoft and non-Microsoft technologies. Currently, he is a subject matter expert in EMEA for RDLC Report development and one of Microsoft EMEA CSS reference for Managed Service for Partners (MSfP). Three times IronMan finisher, Duilio lives in Cernusco Sul Naviglio (Italy) with his beloved wife Laura and his 2 years old son Leonardo.
Read more about Duilio Tacconi

View More author details
Right arrow

Report Development with AL

In this book, we have been introduced to and analyzed a vast variety of AL language objects, and we've seen how to develop simple to complex extensions with them.

In this chapter, we will deep dive into a specific object and look at its properties, triggers, and methods and how to use it proficiently. This object is the report object.

An overview, with pros and cons, will be provided regarding which tool to use to design and develop datasets and layouts, such as Microsoft Word for Word layouts and Microsoft Report Builder for Report Definition Language (RDL) layouts. We will discuss the main shortcuts, tips, and tricks related to dataset development with Visual Studio Code and both Word and RDL layouts.

In this chapter, we aspire to provide you with the confidence you need to develop Dynamics 365 Business Central report extensions, explain how to...

Anatomy of the AL report object

Requests for new reports come from every department and in many different forms. Most of the time, users have an idea in mind of how they would like the data to be shown.

Nevertheless, a report developer should always keep in mind some important points. Everything is related to data:

  • Retrieval: A good report developer should have a good knowledge of the business process (how data is created, modified, and deleted) and data topology (where data is stored). Data can be retrieved from heterogenous resources that cannot be directly stored in Dynamics 365 Business Central tables. As an example, you might want to run an HTTP call to a web service to gather some data outside the database and store it in a physical or temporary table before processing it.
  • Processing: Some of the data that's presented could be the...

Tools to use for Word and RDL layouts

Visual Studio Code does not have a valid extensionyet—that would replace the best-in-class RDL report editor, which is supported by the Dynamics 365 Business Central development team. With a release every six months, the application is always up to date and, at the time of writing, it deploys Report Viewer 2017 and the latest RDL 2016 schema-based syntax. 

To develop an RDL layout report, you have two choices:

To find out more, please visit the following official reference and this useful blog:...

Converting an existing C/AL report into AL

Making small modifications to an existing report is a very common task. Together with creating new pages and codeunits, this is probably one of the most repetitive and frequent jobs for a developer.

Let's say that we would like to make the following changes to the standard sales order report:

  • Show the Customer Category field in the sales order header
  • Print GIFT in the sales lines for item lines with 100% discount

The current version of the AL Language extension does not have any artifact such as the ReportExtension object that could be used to modify or merge existing reports. Therefore, it is always required to create a brand new report from scratch, even if we need to make very small modifications to the dataset and/or layout.

The easiest way to accomplish this task, then, is to copy and give a different ID to an existing...

Feature limitation when developing an RDL or Word layout report

Basically—and historicallyprofessional report development could/should be done by developing RDL report layouts with Visual Studio and the RDLC report extension installed. The Word document layout has more limitations than RDL and its main advantage is that it is quite popular and easy to adopt by power users.

The major pain points you might find when developing layouts are typically related to documents. The most commonly known ones are as follows:

  • Header and footer space is always retainedReport headers and footers have static content, and they have been engineered so that they are always displayed on every page if they are present. Nevertheless, with RDL, you could use the typical SetData function in the body and the GetData function in the header. An example of this trick can be found...

Understanding report performance considerations

With Dynamics 365 Business Central online, there are performance considerations that need to be taken into account.

Currently, both Word and RDL built-in layouts are rendered in the same application domain process when they run with SAVEASPDF or SAVEAS statements.

Since RDL layouts might enable some external code artifacts that may potentially affect data within the same application domain, it has been decided to run every custom RDL report layout in isolated mode. It's worth noticing that if you develop a report and declare DefaultLayout as RDL and the RDLLayout property, this is considered a built-in layout and should render in the same application domain.

Word layouts, no matter whether they are built-in or custom-made, do not run in isolation.

Enabling application domain isolation for custom RDL layouts provides a...

Summary

In this chapter, we have learned which tools to use to develop reports with AL. We saw how to create RDL and Word layouts and which tools are supported. We got a better understanding of the creation of reports and how to use them. We have also explained how to use txt2al.exe to convert a C/AL report into an AL report and refactor it to be reused within the standard application with a practical example.

In the end, we learned that there are some reporting limitations, a few workarounds, and some performance considerations that can help you become a master in AL report development.

In the next chapter, we'll learn how to build an automated test for Dynamics 365 Business Central to check for application business process consistency and improve the robustness of our development solutions.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Microsoft Dynamics 365 Business Central
Published in: Dec 2019Publisher: PacktISBN-13: 9781789951257
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Stefano Demiliani

Stefano Demiliani is a Microsoft MVP on Business Applications and Azure, MCT, Microsoft Certified Solution Developer (MCSD), Azure Certified Architect, and an expert in other Microsoft related technologies. His main activity is architecting and developing enterprise solutions based on the entire stack of Microsoft technologies (mainly focused on ERP and serverless applications). He has worked with Packt Publishing on many IT books related to Azure cloud applications and Dynamics 365 Business Central and is a frequent speaker at IT conferences around Europe. In his free time Stefano is also a runner and a cyclist.
Read more about Stefano Demiliani

author image
Duilio Tacconi

Duilio Tacconi is a Microsoft Dynamics NAV/Microsoft Dynamics 365 Business Central Escalation Engineer at Microsoft EMEA Customer Support & Services (CSS). He joined Microsoft in 2008 after working in a customer IT department with a focus on system administration and development. Despite graduating with the highest score in Agricultural Science in 1996, he is in the ERP circuit since 1998 as developer and system implementer for several companies with Microsoft and non-Microsoft technologies. Currently, he is a subject matter expert in EMEA for RDLC Report development and one of Microsoft EMEA CSS reference for Managed Service for Partners (MSfP). Three times IronMan finisher, Duilio lives in Cernusco Sul Naviglio (Italy) with his beloved wife Laura and his 2 years old son Leonardo.
Read more about Duilio Tacconi