Using Simplified IF-ELSE condition in BI Publisher

In Oracle BI Publisher allows the use of Conditional Statements in RTF Templates. It uses similar logical conditions in PL/SQL such as IF-THEN, CHOOSE-WHEN, etc. More details and examples can be found from Fusion Middleware Report Designer's Guide for Oracle Business Intelligence Publisher.

However, the documentation provided only shows a scenario wherein you have just one condition. Example is below:

<?if:VENDOR_NAME='COMPANY A'?>This is the Vendor A<?end if?>

However, the code becomes a bit too troublesome and long if you need to have an ELSE condition:

<?if:VENDOR_NAME='COMPANY A'?>This is Vendor A<?end if?>
<?if:VENDOR_NAME!='COMPANY A'?>This is NOT Vendor A<?end if?>

To simplify this, you may use the XSLT function IFELSE that addresses this requirement:


<?xdoxslt:ifelse(VENDOR_NAME='COMPANY A',This is Vendor A,This is NOT Vendor A)?>

It works similar to the DECODE function in PL/SQL.
If the given condition is Satisfied, it will return the first parameter, if not, then it will return the second parameter.

Seems simple enough, eh?
Let me know in the comments if there's any issues!


Recent Posts

SQL Fundamentals

Introduction to SQL and Syntax What is SQL? SQL stands for Structured Query Language. is a standard programming language for accessing datab...

Top Posts