Reports : Custom Reports : JasperReports : Data Source Parameters

Data Source Parameters
You can use data source parameters to define SQL queries to a database. The SQL queries that you define determine the data that displays in the report.
To build a report template, you must include the workspace_id parameter. The workspace_id parameter populates the report with data that is relevant for the current project.
In iReport, when you define the query that the report engine uses to retrieve the database fields, you must pass the workspace_id parameter as part of a WHERE clause in the SQL statement that populates the data source. For example, you can enter SELECT * FROM hosts WHERE workspace_id = $P{workspace_id} to select the discovered hosts for a specific project.