Friday, November 7, 2014

BIP: If , then ,else

 

Looks like whole of the Siebel community has moved onto Open UI, but I am spending more and more time into Siebel-BI Publisher reports and their Integration. I had to setup a really, really complex report template for our Order Management module. The final report has 65 for loops and 162 if conditions , and 85 set_variables ! Though BIP’s function set is nicely documented, there are times, I felt, when a requirement could not be implemented as easily as it seemed. Specially when it comes to condition checks. Here are a few pointers if you get lost.

1: If condition: The function is

<?if:[condition]?>
[statements]
<?end if?>

The actual condition has to be provided after the colon (:) after the if statement. The statements to be executed are to be provided before the <?end if?> tag. For some reason, BIP inserts a new line in the report whenever it sees an if tag.

2: If Inlines:

<?if@inlines:[condition]?>
[statements]
<?end if?>

Same as the if condition above, but @inlines statement prevents BIP from inserting a new line in the output report.

3: If @row  and @column. 

<?if@row:[condition]?>
[statements]
<?end if?>

<?if@column:[condition]?>
[statements]
<?end if?>

 

These are to be used in grid layouts/tables to ensure the output of the condition is printed in the same row or column. Otherwise the output gets wrapped into next rows/columns.

4: If @ context.

<?if@incontext:[condition]?>
[statements]
<?end if?>

The '@incontext' is a useful addition to the 5.6.3 release shortening code requirements further to update attributes, when dealing with text output.

As long as the condition checks are straight, these functions prove enough. But things start getting tricky when you need the else clauses , or to build else-if ladders.

5: if-else. Syntax

<?xdoxslt:ifelse([condition],[true statements],[false statements])?>

A simple if-else check, this function is in the xdoxslt namespace. the [true statements] are executed if the condition is evaluated to true, and [false statements] are executed if not. New lines are not inserted for this function.

6:  else if ladder. Syntax

<?xdofx:if [condition 1] then [true 1] else if [condition 2] then [true 2] end if?>

This xdofx function is used when complex else-if ladders need to be built. It can also be used as simple if else condition, so the second if [condition 2] is not required. New lines are not inserted for this function.

 

The @inlines, @incontext, @row, @column statements can only be used with for-each loops, to avoid the newlines inserted automatically by BIP

eg:  <?for-each@inlines:

 

tmp9B00

Hope this is useful, Happy BIP !

No comments:

Post a Comment