Search This Blog

Showing posts with label BI Publisher Cell Color Red if debit is greater than 1000. Show all posts
Showing posts with label BI Publisher Cell Color Red if debit is greater than 1000. Show all posts

Tuesday, December 28, 2010

XML Publisher (BI Publisher) cell highlighting.

Color change in XML Publisher:

Requirement: If debit or credit value is greater than 1000 then it should become red.
XML File:<?xml version="1.0" encoding="WINDOWS-1252"?>
<!-- Generated by Oracle Reports version 10.1.2.0.2 -->
<XX_GROUP>
<accounts>
<account>
<number>1-100-3333</number>
<debit>100</debit>
<credit>300</credit>
</account>
<account>
<number>1-101-3533</number>
<debit>220</debit>
<credit>30</credit>
</account>
<account>
<number>1-130-3343</number>
<debit>240</debit>
<credit>1100</credit>
</account>
<account>
<number>1-153-3033</number>
<debit>3000</debit>
<credit>300</credit>
</account>
</accounts>
</XX_GROUP>
RTF Template:

AccountDebitCredit
FE ACCOUNTCH1100.00CH2100.00 E

 
The field definitions for the template are shown in the following table:

Default Text Entry

Form Field Entry

Description
FE <?for-each:account?> Opens the for each-loop for the element account.
ACCOUNT<?number?> The placeholder for the number element from the XML file.
CH1 <?if:debit>1000?><xsl:attribute xdofo:ctx="block" name="background-color">red</xsl:attribute><?end if?> This field holds the code to highlight the cell red if the debit amount is greater than 1000.
100.00 <?debit?> The placeholder for the debit element.
CH2 <?if:credit>1000?><xsl:attribute xdofo:ctx="block" name="background-color">red</xsl:attribute><?end if?> This field holds the code to highlight the cell red if the credit amount is greater than 1000.
100.00 <?credit?> The placeholder for the credit element.
EFE <?end for-each?> Closes the for-each loop.
The code to highlight the debit column as shown in the table is<?if:debit>1000?>
<xsl:attribute
xdofo:ctx="block" name="background-color">red
</xsl:attribute>
<?end if?>
The "if" statement is testing if the debit value is greater than 1000. If it is, then the next lines are invoked.

That's it!!!