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 :

3 comments:

  1. I cannot find anywhere that identifies the limit to the nesting of the if-the-else statement. Do you know?

    ReplyDelete
  2. Initial You got a awesome blog .I determination be involved in plus uniform minutes. i view you got truly very functional matters , i determination be always checking your blog blesss. wylewki anhydrytowe

    ReplyDelete
  3. Hmm… I interpret blogs on a analogous issue, however i never visited your blog. I added it to populars also i’ll be your faithful primer. pianobeton

    ReplyDelete