birt

Conditionally Change the color of row based on multiple data in BIRT Report


I have a details report that would run on multiple records and display output. For example I have 3 records and the report will display output of 3 pages ( 1 record per page). We have a logic to change the color of a row conditionally as follows,

Record Part Number Status Color
One 12345 SERVICABLE Yellow
Two 56789 UNSERVICABLE Red
Three 10111 REPAIR Green

Based on the Part number and status the color of the row should change. I tried to achieve this using Highlights option however I'm able to pass only the status column hence when the report runs for all the 3 records the color remains the same for all the 3 records though the status is DIFFERENT. I have observed that the report displays the logic based on the STATUS of the first row only. I'm not sure on how to pass the part number because it is unique for each row hence we need to build a logic to use part number and status combination.


Solution

  • Please clarify your question. You say:

    For example I have 3 records and the report will display output of 3 pages ( 1 record per page). ... Based on the Part number and status the color of the row should change.

    These statements seem to contradict each other.

    If each record should be shown on its own page, then using a table is not the right approach anyway.You should use a list instead of a table.

    The rules are simple in BIRT:

    In a header row, a script (or visibility expression, or hihglight rule) sees the values from the first record (of the corresponding group or table/list).

    And in a footer row, a script sees the values from the last corresponding record.

    Only in a detail row can a script see the value of the corresponding detail record.

    Probably you added your highlight rule at the wrong level, e.g. to the table as a whole.