My datasource is like this:
final Collection<Map<String, ?>> summaryList = new ArrayList<Map<String, ?>>();
parameters.put("P_SUBREPORT", new JRMapCollectionDataSource(summa开发者_JAVA百科ryList));
The collection has only one Map, and this hashmap has all the information I need.
How do I access that information in iReport, knowing that "?" is a regular POJO having for example fields like "name" and "hours"?
I've this in my masterReport:
<subreport>
<reportElement stretchType="RelativeToBandHeight" x="0" y="21" width="802" height="58"/>
<dataSourceExpression><![CDATA[$P{P_SUBREPORT}]]></dataSourceExpression>
<subreportExpression><![CDATA["subReport.jasper"]]></subreportExpression>
</subreport>
What would I have in the subreport? The following?
<field name="hours" class="java.lang.Double"/>
<field name="name" class="java.lang.String"/>
精彩评论