There are times when we need to use different customized datasources between reports and subreports. This can be done in a JasperReport by adding one line to the .jrxml file. Inside the subreport section of the file add this line:
<dataSourceExpression><![CDATA[new R251DataSource(($F{person_id}).toString())]]></dataSourceExpression>
Which is dependent on the data source class. This one uses a data source provider R251DataSource. The expression:
$F{person_id}).toString()
Takes the field person_id, makes it into a String and passes it to the data source constructor, which then uses it as a parameter to run a stored procedure
Submit a Comment