Conditional Format Statements in BI/XML Publisher :

If

if-then-else

choose- when-otherwise

The Conditional Formatting using if statement:

If statement:

Use if statement to define a simple condition; for example, if a data field is a specific value.

Insert the following syntax to designate the beginning of the conditional area.

<?if:condition?>

Insert the following syntax at the end of the conditional area: <?end if?>

For example display 10th department employees

       <?if:DEPTNO=10?>

       <?end if?>

BI Publisher supports the common programming construct “if-then-else“. This is extremely useful when you need to test a condition and conditionally show a result

 IF COMM IS NULL THEN ‘N’

ELSE  ‘Y’ 

END IF

<?xdofx:if COMM=” then ‘N’ else ‘Y’ end if?>

Output:

Choose- when-otherwise statement:

 

Use the choose, when, and otherwise elements to express multiple conditional tests. If certain conditions are met in the incoming XML data then specific sections of the template will be rendered. This is a very powerful feature of the RTF template. In regular XSL programming, if a condition is met in the choose command then further XSL code is executed

Use the following syntax for these elements:

<?choose:?>

<?when:expression?>

<?otherwise?><?end otherwise?>

<?end choose?>

Example:

<?choose:?>

<?when: DEPTNO=10?>Ten<?end when?>

<?when: DEPTNO=20?>Twenty<?end when?>

<?when: DEPTNO=30?>Thirty<?end when?>

<?otherwise?>N/A<?end otherwise?>

<?end choose?>

Output:

Recent Posts

Start typing and press Enter to search