Creating Reports with iReports and JasperReports
June 23, 2005
Modifying the Report
Filter Results
Next we'll look at filtering the results returned by our SQL query. iReport allows the designer to add parameters to the report that can be used to filter the SQL results. To add a parameter select "View / Report Parameters" and then click New.
For this example, we defined a parameter with the following values:
To add a where condition filter, open the query
edit dialog ("Datasource / Report query"). We'll
modify the SQL statement to look like:
SELECT ID, Name, Address, City, PostalCode FROM Customer WHERE Name Like '$P!{NameFilter}%'.
If we had hard coded the WHERE condition, it might
look like: WHERE Name Like 'ABC%'. To
insert the parameter value we replace ABC with
$P!{NameFilter}. When the report runs,
$P!{NameFilter} will be replaced with
the supplied actual value.
Serving JasperReports From a Web Server Using Tomcat
The next thing we will look at is serving our report from a webserver using the Apache Tomcat webserver / servlet container. Installing and configuring Tomcat is beyond the scope of this article. The official Tomcat site can be found at http://jakarta.apache.org/tomcat/index.html.

