Saturday, 4 February 2017

RTF Colour Template in BI Publisher


Introduction

We can  Colour our Custom RTF Template in Oracle 12.1.3 or later.
1.      The below example demonstrate how to set background Colour on every other row with different conditions in Bi Publisher.
2.   We can add more characters in “Advanced” tab rather than “Form Field Text” box.

Business Requirement

     This report is used to analyze the HR to find out the Salary Percentage of the Employees.  

Example:

The below example shows how to set a background Colour on every other row based on Employee Salary.
If Employee (SALARY>=4500 and SALARY<=100) then background Colour set to #ffffba

If Employee (SALARY>=4500) then background Colour set to   #baffc9

If Employee (SALARY<=500) then background Colour set to #ffb3ba    

If the above condition is not satisfied then background Colour is set to default Colour (i.e White)

We are using “when” and “otherwise” condition tag to handle background Colour.

<?choose:?> <?when:(SALARY<=4500 and SALARY >=2000)?>
<?attribute@incontext:background-Colour;#ffffba?>
<?end when?>
<?when:(SALARY>=4500)?><?attribute@incontext:background-Colour;#baffc9?>
<?end when?>
<?when:(SALARY<=500)?><?attribute@incontext:background-Colour;#ffb3ba?><?end when?>
<?end choose?>


Note: There is limit in BI Publisher to enter conditions in Form Field (i.e. 138 characters).


But in Advanced tab, we can enter 393 characters.
   


Sample RTF:

Last Name
First Name
Hire Date
Salary
F LAST_NAME li
FIRST_NAME li
HIRE_DATE li
SALARY li E
 
 Sample XML File:




Sample Output:
     a)      SALARY>=4500 and SALARY<=100


     b)     SALARY>=4500
                   

    c)      SALARY<=500
  

No comments:

Post a Comment