Pentaho 5.0 Reporting by Example
上QQ阅读APP看书,第一时间看更新

Time for action – configuring the Details Footer section

Next, we will configure the Details Footer section as seen here:

  1. We will make the Details Footer section visible in our report. The Details Footer section is commonly used to place a summary of what was seen in Details.
  2. Go to the Structure tab, and in the hierarchical tree, navigate to Master Report | Group: | Details Body | Details Footer. Then configure Attributes.hide-on-canvas with the value false:
  3. We will add the following two labels in the work area of this section:
    • Total Articles:
    • Total Sales:
  4. And we will set the following value for both of them:
    • Style.bold = true
  5. Next, we will create a function to count the rows, in this case, of the products sold.

    We create the Count (Running) function, found in the Running category, and configure it with the following characteristic:

    • Function name = ProductCounter
    Note

    The functions that include the word Running as part of their name tell us that they are executed as the data is processed, that is, on the fly. In this case, Count (Running) will count the report's rows as they are presented in the Details section of each page.

  6. Similarly to the previous step, we create a function that will take a sum of the sales made.

    We create the Sum (Running) function, found in the Running category, and configure it with the following characteristics:

    • Function name = SumQty
    • Field name = Quantity
    Note

    In this case, Sum (Running) will take a sum of the Quantity field as the data is presented in the Details section of each page.

  7. Now we place the two recently created functions to the right of the label that corresponds to each, that is, we will place ProductCounter to the right of the first label and SumQty to the right of the second label.

    Let's consider, when we are laying out the report, that an object we have inserted becomes red; refer to the following example:

    This indicates that this object is superimposed on another object and that it is possible that when the report is executed, this object will not be viewable normally. In these cases, we should arrange and resize the objects so that none are superimposed.

  8. We copy the horizontal line (Time for action – configuring the Details Footer section) created earlier by pressing the Time for action – configuring the Details Footer section icon. We select the Details Footer section and paste the horizontal line by pressing the Time for action – configuring the Details Footer section icon. Then we position it in the upper part of this section.
  9. We see what the report looks like at this point. Press the preview button. We should obtain the following result:

What just happened?

We customized our report's Details Footer section. We created and added two functions, one to calculate the quantity of articles sold and another to calculate the sum of the sales.