main report:
1 add variable
<variable name="Variable_rule" class="java.lang.String" resetType="None"> <variableExpression><![CDATA[$F{rule name}]]></variableExpression> <initialValueExpression><![CDATA[$F{rule name}]]></initialValueExpression> </variable>
2 add subreportParameter
<subreport> <reportElement x="-20" y="0" width="480" height="100" uuid="65fbc18f-3989-4701-ba4a-da8222d0a54d"> <property name="com.jaspersoft.studio.unit.x" value="pixel"/> <property name="com.jaspersoft.studio.unit.y" value="pixel"/> </reportElement> <subreportParameter name="P_ruleName"> <subreportParameterExpression><![CDATA[$V{Variable_rule}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression> <subreportExpression><![CDATA["src/table/jasper/Blank_A4_1.jasper"]]></subreportExpression> </subreport>
subreport:
1 add parameter
<parameter name="P_ruleName" class="java.lang.String"/>
2 filter data
<filterExpression><![CDATA[$V{Variable_rule}.equals($P{P_ruleName})]]></filterExpression>
时间: 2024-10-12 03:50:01