Search code examples
oracle-databasertfobieebi-publisher

Standalone ELSE in BI Publisher RTF Templates


I understand that there is an IF-ELSE Statement in XML Publisher RTF Templates, that goes something like below:

<?xdofx:if ELEMENT1='A' then 'The Letter is A' else 'The Letter is not A' end if?>

However, i'm looking to use the IF statement in showing different data tables depending on the value. Something like the below pseudo code:

IF BUSINESS_GROUP IS BG-A THEN SHOW TABLE with COLUMNS A B and C, IF NOT, then SHOW TABLE with COLUMNS X Y and Z

I was able to do this by using 2 separate IF Statements:

<?xdofx:if BUSINESS_GROUP='A'> SHOW TABLE with COLUMNS A B and C <?end if?>

<?xdofx:if BUSINESS_GROUP!='A'> SHOW TABLE with COLUMNS X Y and Z <?end if?>

I'm hoping that I can just use a statement like <?ELSE?>but it does not work.

Any tips?


Solution

  • As @Peter Paff showed, <?choose:?> is a good route to go. It can be a little "bulky", but if you ever need to add more conditions it seems to become easier to follow.

    There is another (perhaps "bulkier") option for your very specific condition: If the TABLE you reference is one table and you are only wanting to show/hide certain columns of that table based on conditions, you could add those conditions to each column (or group of columns) that you wish to show (or hide) using: <?if@column:?>.

    For details see Oracle Fusion Middleware Report Designer's Guide for Oracle Business Intelligence Publisher 12.2.1.2.0 -> Creating RTF Templates -> Using Conditional Formatting - especially the section on Formatting Columns.