Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JasperReport中的条件列表循环_Java_Jasper Reports_Ireport - Fatal编程技术网

Java JasperReport中的条件列表循环

Java JasperReport中的条件列表循环,java,jasper-reports,ireport,Java,Jasper Reports,Ireport,如果列表的大小大于2,则该列表将有另一个附件(另一个模板)文件 <![CDATA[$P{policyInsuredPersonBeneficiariesList}.size() < 3]]> 顺便说一句:我使用JasperReport 5.1是否有可能在调用导出程序后修改列表(存储在$p{PolicyInsuredPersonBeniciariesList})?@Alex K,我没有修改,我只是将列表作为参数传递。请在单独的变量中分隔列表大小信息(如果可能)。因此,在IF子句

如果列表的大小大于2,则该列表将有另一个附件(另一个模板)文件

<![CDATA[$P{policyInsuredPersonBeneficiariesList}.size() < 3]]>

顺便说一句:我使用JasperReport 5.1

是否有可能在调用导出程序后修改列表(存储在$p{PolicyInsuredPersonBeniciariesList})?@Alex K,我没有修改,我只是将列表作为参数传递。请在单独的变量中分隔列表大小信息(如果可能)。因此,在IF子句中,使用变量很容易在比较之前检查值。计算填充列表时的生命周期与调用表达式的子报表/带区。
<parameter name="policyInsuredPersonBeneficiariesList" class="java.util.List"/>
.....
<componentElement>
    <reportElement uuid="e7c57647-5643-443f-bc07-c0e4ff6c5392" x="124" y="412" width="140" height="18" isPrintWhenDetailOverflows="true">
        <printWhenExpression><![CDATA[$P{policyInsuredPersonBeneficiariesList}.size() > 2]]></printWhenExpression>
    </reportElement>
    <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical" ignoreWidth="false">
        <datasetRun subDataset="dsInsuredPersonBeneficiaries" uuid="03295256-f4a3-4bd9-85bf-7a01896a544b">
            <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{policyInsuredPersonBeneficiariesList})]]></dataSourceExpression>
        </datasetRun>
        <jr:listContents height="18" width="140">
            <textField isStretchWithOverflow="true">
                <reportElement uuid="8a76ba89-7f02-4755-86d0-c9789925bf2a" stretchType="RelativeToBandHeight" x="0" y="1" width="140" height="15"/>
                <textElement>
                    <font fontName="Zawgyi-One" size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{fullName}+" - "+$F{percentage}+"% - "+((org.ace.insurance.system.common.relationship.RelationShip)$F{relationship}).getName()]]></textFieldExpression>
            </textField>
        </jr:listContents>
    </jr:list>
</componentElement>
1) generateLifePolicyIssueSingle(org.ace.insurance.report.test.ReportTest)
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
    at java.util.ArrayList.RangeCheck(Unknown Source)
    at java.util.ArrayList.remove(Unknown Source)
    at java.util.Collections$SynchronizedList.remove(Unknown Source)
    at net.sf.jasperreports.engine.JasperPrint.removePage(JasperPrint.java:535)