In today's article, we will discuss an important change regarding the principle of creating Master-Detail reports in Stimulsoft products.

What is a Master-Detail report?

Master-Detail is a type of report in which data is interconnected and organized into several levels: one Master band data record corresponds to several Detail data band records. In other words, the Master-Detail report is a data with detailization, for instance, a report where data is displayed by categories:


In the viewer above, we see a standard example: information about each product category is displayed first, followed by a list of products belonging to that category.

Master-Detail report structure

Our product offers two ways for the relative position of bands in the Master-Detail report.

The first way is to place the Detail band after the Master band:



The second way is to place the Detail band within the Master band; in this case, we will refer to it as a nested Detail band.

Detail band within the Master band Note!

The Panel component is used as a container for other elements. You can place one or more elements on one panel. Only Cross bands can be placed directly on other bands; other bands can only be placed in containers.
The two ways for placing bands described above function in the same way. The choice of option depends solely on the appearance of the report you wish to achieve. In practice, the second option is usually chosen when there is a small amount of data for a detail section.

Features of building Master-Detail reports

The report sample at the beginning of the article demonstrates the so-called “ideal situation” in which all categories contain product data. However, in real data, some categories may not contain any products. Consequently, there may be nothing to display in the category details.

In practice, there is often no need to display empty categories. Therefore, by default, our engine hides them. However, users can choose whether to display empty categories or not. They can use the master band property Print if Detail Empty to do this. If the value of this property is set to true, then all records of the master band will be printed regardless of whether there is Detail data for them.

Changes in the operation of the PrintIfDetailEmpty property

Let's proceed to the main topic of the article. Beginning from version 2023.2, the logic of the PrintIfDetailEmpty property has been enhanced. Previously, the property only functioned with Detail bands located after the Master band. Now, the property also operates for Detail bands located within the Master band. Note!

Previously, nested detail bands were displayed in any case, regardless of the value of the PrintIfDetailEmpty property of the master band. Therefore, if the property is already set to true for the master band, then nothing will change; the detail band will be displayed as before.
Technically, nested bands have always been considered detail bands, regardless of whether they have the MasterComponent property set. However, since the PrintIfDetailEmpty property had no effect on them before, users were unaware of it.

Thus, this modification may affect some reports with nested bands that were not originally created as Master-Detail reports. If the nested band does not have data, then the main band will not be displayed either.

Solution

If the problem described above occurs in your report, you can solve it in one of the following ways:

  • Set the value of the PrintIfDetailEmpty property to true for a band that contains other nested bands;

  • Set the value of the static property from the application code.
    StiOptions.Engine.CheckForEmptyNestedDetail=false

If the problem affects a large number of your reports, or you do not have the time to change your reports, you can use the second option. However, it affects all reports. If, in a report, you need to remove the Master band, and it has no detailization, you will still have to use the first option, that will require changes in each report.

Please also note that some properties from StiOptions are introduced only to ensure backward compatibility with older versions. Someday, during the next major refactoring, these properties may be marked as Obsolete and removed a few years later.
By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.