开发者

Accessing JRMapCollectionDataSource in JasperReports (using iReport)

开发者 https://www.devze.com 2023-04-12 19:19 出处:网络
My datasource is like this: final Collection<Map<String, ?>> summaryList = new ArrayList<Map<String, ?>>();

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"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消