Skip to main content

BI Publisher: Passing Runtime Parameters into RTF Template and If conditions

When creating reports using BI Publisher, we could define parameters to dynamically get the proper data set as business needs.



The parameters we created are like the "binding variables" put into the where condition of the SQL (Data Source). Please note the name of the parameter has to be the same.




















If the parameters are also the columns in our data source, it will be displayed in the template as a data attribute, for example,

But in certain scenario, you want to display the input parameters as independent on the report. The reasons are:

1) If the user input for the parameters doesn't match in our database and there will no rows fetched. In this way, format will give you empty value. But at this moment, you still want to see the user input values from the report even there is no data rows.

2) If the user input parameter is not a binding variable in the where clause. For example, there is a user input parameter called "description" and user could input comments and want to print out their inputs with the report. Since the "description" is not database and   will not work.

So how to pass runtime parameters into template?

Step 1: Assuming the parameter is already created in the BI Publisher Server UI. From the RTF template, declare the parameter as:

where:  
parameter_name is the parameter name
parameter_value is the default value
 
Step 2: Refer to the parameter in the template by prefixing the name with a "$" character

To use if conditions in RTF template:

If we are passing a empty value to the parameters and we need to display some texts if the parameter is empty.

The syntax could be like:
 
For Example:
Please refer the BI Pub document for more details.

Comments

Is there a way to pass a parameter to template without defining in Server side?

Thanks,
Santhosh
Unknown said…
I'm very happy to search out this information processing system. I would like to thank you for this fantastic read!!
Learn XML Publisher Reports for Beginners Actual cost of this course is 9,999/- But now Kuncham Software Solutions Pvt ltd is giving you Free access. Limited period offer Hurry-up Enroll Now at Udemy.
Hurry-Up Enroll Now and get Free Access to the Entire Course