1

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?

Migs Isip
  • 1,450
  • 3
  • 23
  • 50

3 Answers3

1

You are right, there is no standalone 'else' block. For your requirements, you will need to use to if expressions evaluating opposite conditions.

Here is a list of all the different ways an if expression can be used in BIP.

Ranjith R
  • 1,571
  • 1
  • 11
  • 11
1

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.

Moonpie
  • 278
  • 1
  • 3
  • 8
0

The following satisfies your functional requirement, but it's not an if else statement.

<?choose:?>
   <?when: BUSINESS_GROUP='A'?>
      SHOW TABLE with COLUMNS A B and C
   <?end when?>
   <?otherwise:?>
      SHOW TABLE with COLUMNS X Y and Z
   <?end otherwise?>
<?end choose?>

This is comparable to a switch/case/evaluate statement in other programming languages.

Based
  • 950
  • 7
  • 18
  • just to add, i believe WHEN does not allow multiple conditions (i.e. when BUSINESS_GROUP = 'A' and SOURCE='X')? – Migs Isip Oct 12 '18 at 21:33