Advanced Jasper Reports with MIStudio and TransSECS: Using Parameters
Step 1. Define Parameters
Parameters are passed into the report generator so that they can be used in the SQL query for the report
Parameters are referenced in Jaspersoft Studio with a $P{} designation. For example a parameter called “startdate” would be referenced as $P{startdate}.
Step 2. Use Parameters in the SQL queries
use $P{parameter name} as a placeholder for the passed in parameter called “parameter name”.
Step 3. Make a report table which uses the parameters.
Important: do not skip this step or the default parameter values you used for testing the query will be used in your report
Step 4. Test
Debugging
To log the JDBC activity for the report, use log4j and the logger “net.sf.jasperreports.engine.query.JRJdbcQueryExecuter” in the log4j.xml.
For example:
<logger name="net.sf.jasperreports.engine.query.JRJdbcQueryExecuter" additivity="false"> <level value="debug"/> <appender-ref ref="someappender" /> </logger>
where you have defined “someappender” in your log4j.xml file, such as a file or console appender.