Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
BIRT Report Filtering
Divey
Hi All,<br />
<br />
I am facing a problem creating Filters for BIRT Report when the parameters are kept null.<br />
What i want is that, I need to filter the data even if one parameter is kept null.<br />
<br />
Like, I have an Employee Table to filter. Fields are emp_id, emp_name, emp_desc, emp_gender etc.<br />
<br />
<strong class='bbc'>Now i create a filter for all these fields, but i keep emp_desc, emp_gender as Empty Parameter Values. </strong><strong class='bbc'>Now my requirement is to filter the data with only emp_id, emp_name without considering those empty values</strong>.<br />
<br />
Thanks in advance for your help.<br />
<br />
Regards<br />
Divey jain
Find more posts tagged with
Comments
thuston
You could try multiple query parameters in your SQL:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>... WHERE (emp_id = ? OR ? Is NULL OR ? = '') AND ...</pre>
The three DataSet parameters can be linked to a single Report parameter.<br />
<br />
Another option is to dynamically build your WHERE clause in the beforeOpen script.<br />
Make your query with a dummy condition ... WHERE 1=1 ...<br />
In the beforeOpen build the real condition and insert it.<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>var condition = "";
if( params["EMP_ID"].value != null && params["EMP_ID"].value != "" )
{
condition = condition + " emp_id = '" + params["EMP_ID"].value + "' ";
}
...
queryText = queryText.replace("1=1",condition);</pre>