将基本类型对象列表作为子报表的数据源传递 [英] Passing the List of primitive type objects as datasource for subreport
问题描述
我需要在主报告的 列表< String>
dataSource 传递给我的子报告> 参数。我不知道什么是 dataSource 的类型是正确的以及如何在子报表中获取值。
I need to pass to my subreport a dataSource with help of master report's List<String>
parameter. I don't know what is a type of dataSource is correct and how to get value in subreport.
主报告中的片段:
<parameter name="seznamPriloh" class="java.util.List" isForPrompting="false"/>
....
<subreport>
<reportElement x="0" y="56" width="555" height="76"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{seznamPriloh})]]></dataSourceExpression>
<subreportExpression><![CDATA[cz.alis.keong.jasjdr.reporting.ReportCompiler.compile("R79_SeznamPriloh")]]></subreportExpression>
</subreport>
我的子报告中的代码段:
The snippet from my subreport:
<detail>
<band height="23">
<textField>
<reportElement x="56" y="3" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{}]]></textFieldExpression>
</textField>
</band>
</detail>
请告诉我如何通过主报告的 参数将数据源传递到子报告 java.util.List< String>
类型。
Please advise me how to pass the datasource to subreport via master report's parameter of java.util.List<String>
type.
编辑:08.14 14 :20
添加标签到Java
08.14 14:20 Add Tags to Java
编辑:08.14 15:30
与如何打印iReport中另一个列表中包含的字符串列表?适用于4.5.0和 列表< String>
08.14 15:30
relates with How do I print a list of strings contained within another list in iReport? and works for 4.5.0 And List<String>
推荐答案
您必须指定在子报表中使用的字段。您正在传递 $ F {}
并且正在传递列表< String>
作为数据源,您应该将 $ F {_THIS}
。当然你也必须添加一个具有该名称的字段,只有你可以使用表达式 $ F {somefield}
。
You have to specify what field you're using in your subReport. You are passing $F{}
and as you are passing a List<String>
as a DataSource you should put $F{_THIS}
. Of course you have to add a field with that name too, only doing that you can use the expression $F{somefield}
.
这篇关于将基本类型对象列表作为子报表的数据源传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!