To pass parameters to a relational data source in BIRT:
- Set up appropriate Report Parameters (via the Data Explorer).
- Add parameter markers (ie.
?
s) to your SQL query where you want to parameterise the query (eg. if you want to select customers by country, change your datasource query to be SELECT * FROM CUSTOMER WHERE COUNTRY = ?
).
- Add dataset parameters to your dataset (via the Parameters tab of the Edit Data Set dialog) in the order they appear in your SQL query, and specify the corresponding Report Parameter in the
Linked to Report Parameter
value of the New Parameter dialog. (This is how you manually bind the Report Parameters to the parameters in the query - you will need to set up a dataset parameter for each parameter marker in the SQL query.)
If you now preview the report, it should prompt you for parameter values and then display the report (appropriately filtered).
If you were using a non-relational data source, you would set up a filter at the dataset level instead of parameterising the query - there is an example of this approach here. (You can do this with SQL-based reports too, but it is less efficient than filtering at the query level.)