Time for action – using functions to configure styles

We will now create a function to obtain the maximum value for sum_amount present in our report. We will then use the said value to obtain its corresponding customer and apply a bold style onto it.

  1. In the Summary category, we will create a new function Maximum and configure the following:
    • Function Name = MaxSumAmount
    • Field Name = sum_amount
  2. Now we will select the Message object we placed in the Details section of our report and configure the following:
    • Style.bold: =IF([sum_amount]=[MaxSumAmount];"true";"false")

    This formula will analyze row by row if the current value of sum_amount equals MaxSumAmount (the maximum value for sum_amount). If such a condition is true, the name of the customer shall be put in bold, if it is false, it will retain the current style.

    Note

    In later chapters, we will discuss greater detail the definition of formulas.

  3. If we now perform a preview on our report, we will be able to see how the style for the customer with the greatest amount has been changed:
    Time for action – using functions to configure styles

What just happened?

We created a function Maximum of the type Summary so that it obtains the greatest value for sum_amount. We selected the message object, which contains the description of the current customer, and configured its style to be Style.bold when the current customer is the one who possesses the maximum amount value.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset