Reader small image

You're reading from  Pentaho 5.0 Reporting by Example: Beginner's Guide

Product typeBook
Published inAug 2013
PublisherPackt
ISBN-139781782162247
Edition1st Edition
Tools
Right arrow
Author (1)
Right arrow

Time for action – styles with formulas


We will configure the rectangle's Style.bg-color property, which we have previously placed in the Details section, so that its color will be defined based on a row-by-row evaluation of the sum_amount field. We will use the formula editor and the IF function to do so. Next, we will create two parameters so that the final user can establish the conditions based on which the rectangle will be colored. What we will do now is create a formula so that the background color of the rectangle we added earlier changes according to certain values.

  1. We select Rectangle, and in the Style tab, press the button found on the right of bg-color:
  2. This will open the formula editor. In Formula:, we type the following:

    =IF([sum_amount]<4;"#990000";IF([sum_amount]<6;"#cccc00";"#66cc00"))
  3. Next, we click on OK to continue.

We will explain each part of this calculation, but first we will talk a bit about the function IF. The IF function receives the following three parameters...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Pentaho 5.0 Reporting by Example: Beginner's Guide
Published in: Aug 2013Publisher: PacktISBN-13: 9781782162247