首页 > 解决方案 > 如何在 Jasper Studio 中计算表格和表格返回值的总和?

问题描述

我有一个带有表格和组的报告。我需要报告的列页脚使用表的变量 retuned 进行求和。可能吗?

我做了一个例子。在此示例中,我希望变量“sumItemValueFromTable”显示值 10000.0。目前,结果为 0.0。

这是报告的 JRXML 文件:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.0.final using JasperReports Library version 6.4.1  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="example_report" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isFloatColumnFooter="true" uuid="98b654fa-866e-4db4-9a3d-372b1e6e06c7">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="datasouce"/>
    <style name="Table_TH" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table_CH" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
        <conditionalStyle>
            <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
            <style backcolor="#FBFDFF"/>
        </conditionalStyle>
    </style>
    <subDataset name="items" uuid="940ee07b-57c1-48bd-bbfe-9ee2ac66d304">
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="datasouce"/>
        <queryString language="json">
            <![CDATA[items]]>
        </queryString>
        <field name="itemName" class="java.lang.String">
            <property name="net.sf.jasperreports.json.field.expression" value="itemName"/>
            <fieldDescription><![CDATA[itemName]]></fieldDescription>
        </field>
        <field name="itemValue" class="java.lang.Double">
            <property name="net.sf.jasperreports.json.field.expression" value="itemValue"/>
            <fieldDescription><![CDATA[itemValue]]></fieldDescription>
        </field>
        <variable name="sumItem" class="java.lang.Double" calculation="Sum">
            <variableExpression><![CDATA[$F{itemValue}]]></variableExpression>
            <initialValueExpression><![CDATA[0.0]]></initialValueExpression>
        </variable>
    </subDataset>
    <queryString language="json">
        <![CDATA[]]>
    </queryString>
    <field name="userName" class="java.lang.String">
        <fieldDescription><![CDATA[userName]]></fieldDescription>
    </field>
    <field name="userDescription" class="java.lang.String">
        <fieldDescription><![CDATA[userDescription]]></fieldDescription>
    </field>
    <variable name="sumItemValueGeneral" class="java.lang.Double" calculation="Sum">
        <variableExpression><![CDATA[$V{sumItemValueFromTable}]]></variableExpression>
        <initialValueExpression><![CDATA[0.0]]></initialValueExpression>
    </variable>
    <variable name="sumItemValueFromTable" class="java.lang.Double" resetType="Group" resetGroup="user">
        <initialValueExpression><![CDATA[0.0]]></initialValueExpression>
    </variable>
    <group name="user">
        <groupExpression><![CDATA[$F{userName}]]></groupExpression>
        <groupHeader>
            <band height="15">
                <textField>
                    <reportElement x="80" y="0" width="720" height="15" uuid="4169f25b-4f54-4aa1-9621-38d9d26fba36"/>
                    <textElement textAlignment="Left" verticalAlignment="Middle"/>
                    <textFieldExpression><![CDATA[$F{userName} + " - " + $F{userDescription}]]></textFieldExpression>
                </textField>
                <staticText>
                    <reportElement x="0" y="0" width="80" height="15" uuid="6764c7d6-fd26-4057-8120-63f4b55f3100">
                        <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    </reportElement>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="9" isBold="true"/>
                    </textElement>
                    <text><![CDATA[User:]]></text>
                </staticText>
            </band>
        </groupHeader>
        <groupFooter>
            <band height="15">
                <staticText>
                    <reportElement x="0" y="0" width="180" height="15" uuid="b61688ee-94d6-4c74-aa6f-035b7bbd6dbd">
                        <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    </reportElement>
                    <textElement textAlignment="Right" verticalAlignment="Middle">
                        <font size="9" isBold="true"/>
                    </textElement>
                    <text><![CDATA[USER SUM]]></text>
                </staticText>
                <textField>
                    <reportElement x="180" y="0" width="100" height="14" uuid="919abbde-42c3-4503-bcc8-ad68ffac7950"/>
                    <textElement textAlignment="Right" verticalAlignment="Middle">
                        <font isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$V{sumItemValueFromTable}]]></textFieldExpression>
                </textField>
            </band>
        </groupFooter>
    </group>
    <title>
        <band height="15" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="800" height="15" uuid="b71231cd-1292-4cad-96fb-918dc371bf78">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[My report]]></text>
            </staticText>
        </band>
    </title>
    <pageHeader>
        <band height="17" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="2" width="800" height="15" uuid="5f05f44c-eabb-4aaf-b3c2-6c2512f60f73">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[A page header]]></text>
            </staticText>
        </band>
    </pageHeader>
    <columnHeader>
        <band height="15" splitType="Stretch">
            <staticText>
                <reportElement x="80" y="0" width="100" height="15" uuid="f4a14a24-b4cb-46d4-a799-f7401178d6b7">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Name]]></text>
            </staticText>
            <staticText>
                <reportElement x="180" y="0" width="100" height="15" uuid="63b605a9-d94e-449f-b4e8-c5b5fa2352fe">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Value]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="15" splitType="Stretch">
            <componentElement>
                <reportElement x="80" y="0" width="200" height="15" uuid="36dcd5f4-e9bd-4577-8ff4-dceacfa42263">
                    <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
                    <property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
                    <property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
                    <property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                    <datasetRun subDataset="items" uuid="98564efc-611d-4267-b650-20b8ce408049">
                        <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("items")]]></dataSourceExpression>
                        <returnValue fromVariable="sumItem" toVariable="sumItemValueFromTable"/>
                    </datasetRun>
                    <jr:column width="100" uuid="594a2c22-50a2-4cb3-bd1b-5b73edb3e8c5">
                        <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                        <jr:detailCell style="Table_TD" height="15">
                            <property name="com.jaspersoft.studio.unit.height" value="px"/>
                            <box>
                                <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                            </box>
                            <textField>
                                <reportElement x="0" y="0" width="100" height="15" uuid="466d9b29-f34d-4718-8f33-47019eaac2f4">
                                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                                </reportElement>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{itemName}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="100" uuid="5a0cc5e4-46b3-463a-8e5e-b14f2444559f">
                        <jr:detailCell style="Table_TD" height="15">
                            <box>
                                <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                            </box>
                            <textField>
                                <reportElement x="0" y="0" width="100" height="15" uuid="404014b5-2c4b-4479-8a61-517700f7bdd2"/>
                                <textElement textAlignment="Right" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{itemValue}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
        </band>
    </detail>
    <columnFooter>
        <band height="15" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="180" height="15" uuid="b27a2374-0c07-429c-820f-d44a52faf5b8">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="9" isBold="true"/>
                </textElement>
                <text><![CDATA[GENERAL SUM]]></text>
            </staticText>
            <textField evaluationTime="Band">
                <reportElement x="180" y="-1" width="100" height="16" uuid="34659bd7-0bb3-4001-9767-91489dc96329"/>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{sumItemValueGeneral}]]></textFieldExpression>
            </textField>
        </band>
    </columnFooter>
</jasperReport>

这是我使用的 JSON 数据源:

[
    {
        "userName": "User A",
        "userDescription": "Description A",
        "items": [
            {
                "itemName": "Item A",
                "itemValue": 100.0
            },
            {
                "itemName": "Item B",
                "itemValue": 200.0
            }
        ]
    },
    {
        "userName": "User B",
        "userDescription": "Description B",
        "items": [
            {
                "itemName": "Item A",
                "itemValue": 400.0
            },
            {
                "itemName": "Item B",
                "itemValue": 300.0
            }
        ]
    }
]

标签: jsonjasper-reportsreturn-value

解决方案


按照您的代码布局,解决方案是在表的子数据集中定义另一个类似于变量的变量,sumItem因为您只能在 JasperSoft Studio 中为每个变量定义 1 个返回值(版本 <=6.6.0 有这个奇怪的错误),如果您直接编辑 jrxml您可以避免此步骤,而是在 returnValue 中使用先前的变量。

<variable name="sumItemForTotale" class="java.lang.Double" calculation="Sum">
    <variableExpression><![CDATA[$F{itemValue}]]></variableExpression>
</variable>

sumItemValueGeneral然后通过计算将其返回给变量Sum

<returnValue fromVariable="sumItemForTotale" toVariable="sumItemValueGeneral" calculation="Sum"/>

现在删除变量中的当前表达式sumItemValueGeneral,而是将其设置为Sum

<variable name="sumItemValueGeneral" class="java.lang.Double" calculation="Sum">
    <initialValueExpression><![CDATA[0.0]]></initialValueExpression>
</variable>

是的,您需要将 variabile 和 returnValue 都设置为Sum个人计算我觉得这有点令人困惑,仅将 variabile 设置为 感觉更合乎逻辑Sum,但我猜逻辑是:如果您没有Sum在 returnValue 中设置(值将被强制复制因为它直接进入变量),如果你没有Sum在变量中设置,变量将在它获得新的“添加”值时重新初始化。

完整的jrxml

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="example_report" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isFloatColumnFooter="true" uuid="98b654fa-866e-4db4-9a3d-372b1e6e06c7">
    <style name="Table_TH" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
        <conditionalStyle>
            <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
            <style backcolor="#FBFDFF"/>
        </conditionalStyle>
    </style>
    <style name="Table_CH" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <subDataset name="items" uuid="940ee07b-57c1-48bd-bbfe-9ee2ac66d304">
        <queryString language="json">
            <![CDATA[items]]>
        </queryString>
        <field name="itemName" class="java.lang.String">
            <property name="net.sf.jasperreports.json.field.expression" value="itemName"/>
            <fieldDescription><![CDATA[itemName]]></fieldDescription>
        </field>
        <field name="itemValue" class="java.lang.Double">
            <property name="net.sf.jasperreports.json.field.expression" value="itemValue"/>
            <fieldDescription><![CDATA[itemValue]]></fieldDescription>
        </field>
        <variable name="sumItem" class="java.lang.Double" calculation="Sum">
            <variableExpression><![CDATA[$F{itemValue}]]></variableExpression>
            <initialValueExpression><![CDATA[0.0]]></initialValueExpression>
        </variable>
        <variable name="sumItemForTotale" class="java.lang.Double" calculation="Sum">
            <variableExpression><![CDATA[$F{itemValue}]]></variableExpression>
        </variable>
    </subDataset>
    <queryString language="json">
        <![CDATA[]]>
    </queryString>
    <field name="userName" class="java.lang.String">
        <fieldDescription><![CDATA[userName]]></fieldDescription>
    </field>
    <field name="userDescription" class="java.lang.String">
        <fieldDescription><![CDATA[userDescription]]></fieldDescription>
    </field>
    <variable name="sumItemValueGeneral" class="java.lang.Double" calculation="Sum">
        <initialValueExpression><![CDATA[0.0]]></initialValueExpression>
    </variable>
    <variable name="sumItemValueFromTable" class="java.lang.Double" resetType="Group" resetGroup="user">
        <initialValueExpression><![CDATA[0.0]]></initialValueExpression>
    </variable>
    <group name="user">
        <groupExpression><![CDATA[$F{userName}]]></groupExpression>
        <groupHeader>
            <band height="15">
                <textField>
                    <reportElement x="80" y="0" width="720" height="15" uuid="4169f25b-4f54-4aa1-9621-38d9d26fba36"/>
                    <textElement textAlignment="Left" verticalAlignment="Middle"/>
                    <textFieldExpression><![CDATA[$F{userName} + " - " + $F{userDescription}]]></textFieldExpression>
                </textField>
                <staticText>
                    <reportElement x="0" y="0" width="80" height="15" uuid="6764c7d6-fd26-4057-8120-63f4b55f3100"/>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font size="9" isBold="true"/>
                    </textElement>
                    <text><![CDATA[User:]]></text>
                </staticText>
            </band>
        </groupHeader>
        <groupFooter>
            <band height="15">
                <staticText>
                    <reportElement x="0" y="0" width="180" height="15" uuid="b61688ee-94d6-4c74-aa6f-035b7bbd6dbd"/>
                    <textElement textAlignment="Right" verticalAlignment="Middle">
                        <font size="9" isBold="true"/>
                    </textElement>
                    <text><![CDATA[USER SUM]]></text>
                </staticText>
                <textField>
                    <reportElement x="180" y="0" width="100" height="14" uuid="919abbde-42c3-4503-bcc8-ad68ffac7950"/>
                    <textElement textAlignment="Right" verticalAlignment="Middle">
                        <font isBold="true"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$V{sumItemValueFromTable}]]></textFieldExpression>
                </textField>
            </band>
        </groupFooter>
    </group>
    <title>
        <band height="15" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="800" height="15" uuid="b71231cd-1292-4cad-96fb-918dc371bf78"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[My report]]></text>
            </staticText>
        </band>
    </title>
    <pageHeader>
        <band height="17" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="2" width="800" height="15" uuid="5f05f44c-eabb-4aaf-b3c2-6c2512f60f73"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[A page header]]></text>
            </staticText>
        </band>
    </pageHeader>
    <columnHeader>
        <band height="15" splitType="Stretch">
            <staticText>
                <reportElement x="80" y="0" width="100" height="15" uuid="f4a14a24-b4cb-46d4-a799-f7401178d6b7"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Name]]></text>
            </staticText>
            <staticText>
                <reportElement x="180" y="0" width="100" height="15" uuid="63b605a9-d94e-449f-b4e8-c5b5fa2352fe"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[Value]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="15" splitType="Stretch">
            <componentElement>
                <reportElement x="80" y="0" width="200" height="15" uuid="36dcd5f4-e9bd-4577-8ff4-dceacfa42263"/>
                <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                    <datasetRun subDataset="items" uuid="98564efc-611d-4267-b650-20b8ce408049">
                        <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("items")]]></dataSourceExpression>
                        <returnValue fromVariable="sumItem" toVariable="sumItemValueFromTable"/>
                        <returnValue fromVariable="sumItemForTotale" toVariable="sumItemValueGeneral" calculation="Sum"/>
                    </datasetRun>
                    <jr:column width="100" uuid="594a2c22-50a2-4cb3-bd1b-5b73edb3e8c5">
                        <jr:detailCell style="Table_TD" height="15">
                            <box>
                                <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                            </box>
                            <textField>
                                <reportElement x="0" y="0" width="100" height="15" uuid="466d9b29-f34d-4718-8f33-47019eaac2f4"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{itemName}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="100" uuid="5a0cc5e4-46b3-463a-8e5e-b14f2444559f">
                        <jr:detailCell style="Table_TD" height="15">
                            <box>
                                <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                            </box>
                            <textField>
                                <reportElement x="0" y="0" width="100" height="15" uuid="404014b5-2c4b-4479-8a61-517700f7bdd2"/>
                                <textElement textAlignment="Right" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{itemValue}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
        </band>
    </detail>
    <columnFooter>
        <band height="15" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="180" height="15" uuid="b27a2374-0c07-429c-820f-d44a52faf5b8"/>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="9" isBold="true"/>
                </textElement>
                <text><![CDATA[GENERAL SUM]]></text>
            </staticText>
            <textField evaluationTime="Report">
                <reportElement x="180" y="-1" width="100" height="16" uuid="34659bd7-0bb3-4001-9767-91489dc96329"/>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{sumItemValueGeneral}]]></textFieldExpression>
            </textField>
        </band>
    </columnFooter>
</jasperReport>

输出

结果


推荐阅读