Follow us: Connect on YouTube Connect on YouTube Connect on YouTube

Pages

Saturday, 2 September 2017

If then Else statement in BI/XML Publisher Reports



Conditional Format Statements:   


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?>

If statement in xml publisher reports


if-then-else statement:



   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:

if else condition Report 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?>
  

Choose- when-otherwise statement


 Output:

Choose- when-otherwise statement: output


Share this article :

0 comments:

Post a Comment