Search This Blog

Thursday 14 March 2013

APEX: Conditional cell formatting of a standard report

For each column, create another column with the color value you wish to pass. ( best as an HTML color code. )

select
Val,
DECODE(Val,1,'#990000',2,'#007700','#BFBFBF') Val_colour
from dual;


Hide the color column.

In the report template, in the column templates create IDs for the TDs. Ie

< td#ALIGNMENT# headers="#COLUMN_HEADER_NAME#" border="0" id="ROW_#COLUMN_HEADER_NAME#" class="data">#COLUMN_VALUE#< /td>

Then using CSS styling in the region header set these IDs to display:none
< style>
#ROW_VAL {display:none !important}
< /style>

After you have done that, you can hijack the HTML expression in the Column attributes and put in your own TD.
< td#ALIGNMENT# headers="VAL" class="data" style="background-color:#VAL_COLOUR#"> #VAL#< /td>

1 comment: