Prashant Kumar
Prashant Kumar

Reputation: 155

Working with Option parameters in BIRT Reporting tool

I have limited knowledge about the BIRT I am still learning.

Case: I have an optional parameter in BIRT if that Parameter is String type I know below way to write it:

and ((? is null) or (file_entered_by_user_table.ss_name = ?))

But the same way doesn't work if the parameter type is Integer. How to write in case of Integer/Float/Date type?

Upvotes: 0

Views: 197

Answers (1)

PrashantChaubey
PrashantChaubey

Reputation: 17

Best way is to give placeholder in your sql and update it on the 'beforeOpen' event of dataset.

eg. Dataset Sql:

 select * from dual --where_clause 

On beforeOpen Event:

  if( params["parameterName"].value != null ) {

     this.queryText = this.queryText.replace("--where_clause", "where field_name = " + 
       params["parameterName"].value); 

  }else { 

       this.queryText = this.queryText.replace("--where_clause", ""); 

  }

This will work for any data type.

Upvotes: 1

Related Questions