在ireport中汇总列值 - 变量未找到错误

时间:2012-12-03 14:59:39

标签: sum ireport xmltable

我使用变量对单列中的所有值(垂直)求和,我在代码中声明如下,但是当我运行代码时,它会给出错误:

。变量未找到。

我在摘要带中打印此表,因为当我在详细信息区域中声明它时,许多页面会重复使用重复的表格。

<?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="intra_fho" language="groovy" pageWidth="648" pageHeight="792" columnWidth="608" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="9a93052d-913c-448c-a2bd-956da96ec037">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <style name="table">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
        <conditionalStyle>
            <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
            <style backcolor="#EFF7FF"/>
        </conditionalStyle>
    </style>
    <style name="table 2">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 2_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 2_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 2_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
        <conditionalStyle>
            <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
            <style backcolor="#EFF7FF"/>
        </conditionalStyle>
    </style>
    <style name="table 3">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 3_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 3_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 3_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
        <conditionalStyle>
            <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
            <style backcolor="#EFF7FF"/>
        </conditionalStyle>
    </style>
    <style name="table 4">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 4_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 4_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 4_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
        <conditionalStyle>
            <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
            <style backcolor="#EFF7FF"/>
        </conditionalStyle>
    </style>
    <style name="table 5">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 5_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 5_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 5_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
        <conditionalStyle>
            <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
            <style backcolor="#EFF7FF"/>
        </conditionalStyle>
    </style>
    <subDataset name="New Dataset 1" uuid="585047d6-61a7-4b62-9dae-49e3ad3b2855">
        <queryString>
            <![CDATA[SELECT
     intra_fho_final.`FirstName` AS intra_fho_final_FirstName,
     intra_fho_final.`DoctorID` AS intra_fho_final_DoctorID,
     intra_fho_final.`for_doctor` AS intra_fho_final_for_doctor,
     intra_fho_final.`by_doctor` AS intra_fho_final_by_doctor,
     intra_fho_final.`Net_Services_by_Physicians` AS intra_fho_final_Net_Services_by_Physicians,
     intra_fho_final.`Value_of_Net_Services` AS intra_fho_final_Value_of_Net_Services
FROM
     `intra_fho_final` intra_fho_final]]>
        </queryString>
        <field name="intra_fho_final_FirstName" class="java.lang.String"/>
        <field name="intra_fho_final_DoctorID" class="java.lang.Integer"/>
        <field name="intra_fho_final_for_doctor" class="java.math.BigDecimal"/>
        <field name="intra_fho_final_by_doctor" class="java.math.BigDecimal"/>
        <field name="intra_fho_final_Net_Services_by_Physicians" class="java.math.BigDecimal"/>
        <field name="intra_fho_final_Value_of_Net_Services" class="java.math.BigDecimal"/>
    </subDataset>
    <queryString language="SQL">
        <![CDATA[SELECT
     intra_fho_final.`FirstName` AS intra_fho_final_FirstName,
     intra_fho_final.`DoctorID` AS intra_fho_final_DoctorID,
     intra_fho_final.`for_doctor` AS intra_fho_final_for_doctor,
     intra_fho_final.`by_doctor` AS intra_fho_final_by_doctor,
     intra_fho_final.`Net_Services_by_Physicians` AS intra_fho_final_Net_Services_by_Physicians,
     intra_fho_final.`Value_of_Net_Services` AS intra_fho_final_Value_of_Net_Services
FROM
     `intra_fho_final` intra_fho_final]]>
    </queryString>
    <field name="intra_fho_final_FirstName" class="java.lang.String"/>
    <field name="intra_fho_final_DoctorID" class="java.lang.Integer"/>
    <field name="intra_fho_final_for_doctor" class="java.math.BigDecimal"/>
    <field name="intra_fho_final_by_doctor" class="java.math.BigDecimal"/>
    <field name="intra_fho_final_Net_Services_by_Physicians" class="java.math.BigDecimal"/>
    <field name="intra_fho_final_Value_of_Net_Services" class="java.math.BigDecimal"/>
    <variable name="for_doctor" class="java.math.BigDecimal" incrementType="Column" calculation="Sum">
        <variableExpression><![CDATA[$F{intra_fho_final_for_doctor}]]></variableExpression>
    </variable>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="49" splitType="Stretch">
            <staticText>
                <reportElement uuid="8a5981f1-7059-4834-ab1b-c0b1e23cba44" x="201" y="10" width="206" height="28"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Times New Roman" size="24"/>
                </textElement>
                <text><![CDATA[Intra-FHO Report]]></text>
            </staticText>
        </band>
    </title>
    <summary>
        <band height="57" splitType="Stretch">
            <componentElement>
                <reportElement uuid="30b3af0e-8160-460f-b1c9-e3d5bce80cbe" key="table 5" style="table 5" stretchType="RelativeToBandHeight" x="56" y="6" width="496" height="44" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true"/>
                <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="New Dataset 1" uuid="79799bc4-801b-440c-a09b-bc24c0542297">
                        <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    </datasetRun>
                    <jr:column uuid="47b87b0f-9b0a-405a-8bec-ff898a66036f" width="90">
                        <jr:columnHeader style="table 5_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement uuid="f7a46f3d-2297-487b-88e6-9150a1b1eca2" x="0" y="0" width="90" height="30"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[First Name]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter height="30" rowSpan="1">
                            <box>
                                <pen lineWidth="0.5"/>
                                <topPen lineWidth="0.5"/>
                                <leftPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                                <rightPen lineWidth="0.5"/>
                            </box>
                            <staticText>
                                <reportElement uuid="0a44ed1e-7ada-4e53-a0f1-f8e80215b921" x="0" y="0" width="90" height="30" backcolor="#19FFFF"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[Total]]></text>
                            </staticText>
                        </jr:columnFooter>
                        <jr:detailCell style="table 5_TD" height="20" rowSpan="1">
                            <textField>
                                <reportElement uuid="6ee7fb55-7327-4386-ac9a-b9f134f87cac" x="0" y="0" width="90" height="20"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{intra_fho_final_FirstName}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column uuid="dbfb1b17-68ce-4a59-869e-0d1a0783c53c" width="90">
                        <jr:columnHeader style="table 5_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement uuid="a497ced3-2a53-4cb7-a1bb-01761cff09e9" x="0" y="0" width="90" height="30"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[DoctorID]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter height="30" rowSpan="1">
                            <box>
                                <pen lineWidth="0.5"/>
                                <topPen lineWidth="0.5"/>
                                <leftPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                                <rightPen lineWidth="0.5"/>
                            </box>
                        </jr:columnFooter>
                        <jr:detailCell style="table 5_TD" height="20" rowSpan="1">
                            <textField>
                                <reportElement uuid="7ab80c20-bf8c-41ce-9758-0c23c3c31614" x="0" y="0" width="90" height="20"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{intra_fho_final_DoctorID}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column uuid="19ca94c6-4b15-43e0-9deb-7d0e4877c74e" width="90">
                        <jr:columnHeader style="table 5_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement uuid="0a9d6455-c731-4e97-8504-60573fbefb38" x="0" y="0" width="90" height="30"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[Services for doctor]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter height="30" rowSpan="1">
                            <box>
                                <pen lineWidth="0.5"/>
                                <topPen lineWidth="0.5"/>
                                <leftPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                                <rightPen lineWidth="0.5"/>
                            </box>
                            <textField>
                                <reportElement uuid="fc9cbc6f-8e58-458b-917b-9ddfd901e7b0" x="0" y="0" width="90" height="30"/>
                                <textElement/>
                                <textFieldExpression><![CDATA[$V{for_doctor}]]></textFieldExpression>
                            </textField>
                        </jr:columnFooter>
                        <jr:detailCell style="table 5_TD" height="20" rowSpan="1">
                            <textField>
                                <reportElement uuid="86d7773c-0639-46a4-bd36-1b1ae44ca117" x="0" y="0" width="90" height="20"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{intra_fho_final_for_doctor}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column uuid="1bba8b0e-1dbb-42fe-99c8-c06ccaeaffd1" width="90">
                        <jr:columnHeader style="table 5_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement uuid="70ba240b-7471-40d0-89af-ffb486c40426" x="0" y="0" width="90" height="30"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[Services by doctor]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter height="30" rowSpan="1">
                            <box>
                                <pen lineWidth="0.5"/>
                                <topPen lineWidth="0.5"/>
                                <leftPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                                <rightPen lineWidth="0.5"/>
                            </box>
                        </jr:columnFooter>
                        <jr:detailCell style="table 5_TD" height="20" rowSpan="1">
                            <textField>
                                <reportElement uuid="3dee1b58-18d9-46d1-9f15-83187acbb958" x="0" y="0" width="90" height="20"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{intra_fho_final_by_doctor}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column uuid="c74af907-1849-414a-af92-e2ce8ae993b9" width="90">
                        <jr:columnHeader style="table 5_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement uuid="e479699f-be34-4b02-ac94-04d081f1f701" x="0" y="0" width="90" height="30"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[Net Services by Physicians]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter height="30" rowSpan="1">
                            <box>
                                <pen lineWidth="0.5"/>
                                <topPen lineWidth="0.5"/>
                                <leftPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                                <rightPen lineWidth="0.5"/>
                            </box>
                        </jr:columnFooter>
                        <jr:detailCell style="table 5_TD" height="20" rowSpan="1">
                            <textField>
                                <reportElement uuid="a1a6b8e4-fde3-4420-98c6-870f22b1227c" x="0" y="0" width="90" height="20"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{intra_fho_final_Net_Services_by_Physicians}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column uuid="beb168ea-b1a8-4ac9-8aae-eb5c15e983f5" width="90">
                        <jr:columnHeader style="table 5_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement uuid="b29fb3a0-5b2a-4ad3-b3c1-9624a2690ac9" x="0" y="0" width="90" height="30"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font isBold="true"/>
                                </textElement>
                                <text><![CDATA[Value of Net Services]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter height="30" rowSpan="1">
                            <box>
                                <pen lineWidth="0.5"/>
                                <topPen lineWidth="0.5"/>
                                <leftPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                                <rightPen lineWidth="0.5"/>
                            </box>
                        </jr:columnFooter>
                        <jr:detailCell style="table 5_TD" height="20" rowSpan="1">
                            <textField>
                                <reportElement uuid="2e6374e8-8e70-4823-97d9-81599f44016f" x="0" y="0" width="90" height="20"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{intra_fho_final_Value_of_Net_Services}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
        </band>
    </summary>
</jasperReport>

0 个答案:

没有答案