Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

When condition in rtf template?

4 Answer(s) Available
Answer # 1 #

Use If statement directly in the template as Text or form field

Use If else statements using xdofx command

Nested If Sample using xdofx

If else condition using xdoxslt

Sample to display different field value based on a field value

Use choose statement if there are multiple conditions

We have to be very careful with the syntax of the statement that we write when we use the OR and AND commands as they don’t work if we don’t follow the proper syntax

Syntax:

Example:

We need to enclose the total condition in braces ( and ).

The operators or & and should be in lower case only else they won’t work properly.

If there are multiple conditions based on which some text needs to be shown it can be written as below using and & or conditions.

[5]
Edit
Query
Report
Ekavali Juyal
AUTOMOTIVE COOLING SYSTEM DIAGNOSTIC TECHNICIAN
Answer # 2 #
  • If statement:
  • Insert the following syntax at the end of the conditional area:
  • IF COMM IS NULL THEN 'N'
  • ELSE 'Y'
  • END IF.
[4]
Edit
Query
Report
Sarwar Dilip-Zafar
Insurance Claims Clerks
Answer # 3 #

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.

Insert the following syntax at the end of the conditional area: 

For example display 10th department employees

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

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:

Example:

Ten

Twenty

Thirty

N/A

Output:

[1]
Edit
Query
Report
René-Charles Dacus
House Manager
Answer # 4 #

When you create a BI Publisher template, you can add conditional statements to determine whether or not a condition is true or false. IF Condition in RTF template allows you to perform actions only when certain conditions are met. For example, you might want to display a message only when the value of a field exceeds a certain threshold.

We can use if condition directly in xml publisher by writing  condition 

But for If-else we need to use extended function.

Method 1:

Example:

Method 2:Syntax:

Example:

The result of the above expression is No 1 is not equal to 2

Using this for a variable

for e.g if counter variable is greater than 0 print 22 else print 33

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 are rendered. This is a very powerful feature of the RTF template.

Recommended post

Variables in BI Publisher RTF template

Bursting in Fusion BIP

[1]
Edit
Query
Report