iReport组总计不起作用

时间:2011-12-19 18:05:08

标签: jasper-reports ireport

我有一个iReport版本4.1.3的工作版本,其中包含文本中所需的百分比,总数,平均值和计数。报告和总计/计算确实适用于此报告。我需要另一个版本完全相同但在组内。我编辑了mysql以按组Territory进行排序,然后添加了报告组。然后我将重置类型更改为组/重置组到区域。我也玩过将增量类型更改为Group /并将组增加到Territory。我目前正在收到一份报告,其中每个数据库行创建一个单独的页面而不是按地区划分的总计。

变量示例:

<variable name="AverageAgeOver61" class="java.lang.Double" resetType="Group" resetGroup="Territory" incrementType="Group" incrementGroup="Territory">
    <variableExpression><![CDATA[$V{TotalAgeOvr61}.equals(0) ? 0 : $V{TotalAgeOvr61} / $V{CountOver61}]]></variableExpression>
</variable>
<variable name="DomantTotalAge" class="java.lang.Double" resetType="Group" resetGroup="Territory" incrementType="Group" incrementGroup="Territory" calculation="Sum">
    <variableExpression><![CDATA[$F{Dormant} ? $F{Age} : 0]]></variableExpression>
</variable>
<variable name="HighRiskPercentage" class="java.lang.Double" resetType="Group" resetGroup="Territory" incrementType="Group" incrementGroup="Territory">
    <variableExpression><![CDATA[$V{totalSystems}.equals(0) || $V{totalSystems}.equals(null) ? 0 : $V{HighRiskSystemTotal} / $V{totalSystems}]]></variableExpression>
</variable>
<variable name="SeviceContractRiskPercentage" class="java.lang.Double" resetType="Group" resetGroup="Territory" incrementType="Group" incrementGroup="Territory">
    <variableExpression><![CDATA[$V{HighRiskServiceTotal}.equals(0) || $V{HighRiskServiceTotal}.equals(null) ? 0:$V{HighRiskServiceTotal}/$V{CurrentServiceAmountTotal}]]></variableExpression>
</variable>

和文本字段示例:

<group name="TerritoryById">
    <groupExpression><![CDATA[$F{TerritoryId}]]></groupExpression>
    <groupHeader>
        <band height="150">
            <textField>
                <reportElement x="2" y="106" width="520" height="23"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="18"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{ClientShort} + " Findings:\n"+
                "a.\t"+new java.text.DecimalFormat("#,##0%").format($V{HighRiskPercentage})   +"    of the systems are in the \"High Risk\" category \n"+
                "b.\t"+new java.text.DecimalFormat("#,##0%").format($V{SeviceContractRiskPercentage})+ "      of service contract revenue is in the \"High Risk\" category\n"+
                "c.\t The average age for all systems in " +new java.text.DecimalFormat("#,##0").format($V{AvgAgeOfSystems}) +   " months, with " +$V{PercentageOver3yrsOld}+  "   of the systems over three years old.\n"+
                "        i.\t" + new java.text.DecimalFormat("#,##0%").format($V{Percentage37To48})+ " -\t  37 to 48 months old,\t"    + $V{CountAge37To48Qty}  +   "  systems \n"+
                "        ii.\t " + new java.text.DecimalFormat("#,##0%").format($V{Percentage49To60})+ " -\t  49 to 60 months old,\t "+ $V{CountAge49To60Qty} + " systems \n"+
                "        iii.\t "  +  $V{Percentage61Months} + " \t  61+ months old,\t\t "    + $V{CountOver61Qty}  +   " systems\n"+
                "d.\t Domant Accounts:\t" +$P{ClientShort}+ " identifies account where there has not been any systems added to the service contract with in the last two years. While these accounts may have purchased upgrades, software and service the lack of system additions is of concern.  For your territory, "+ $V{DomantAccts} + " of " + $V{totalCustomers}
                + " accounts, may be dormant.  This accounts for " + new java.text.DecimalFormat("#,##0%").format($V{PercentageServiceRevenueDorm})+", "+ new java.text.DecimalFormat("\$#,##0.00").format($V{DomantServiceRevenue})+" of the service revenue and  " +new java.text.DecimalFormat("#,##0%").format($V{PercentDomantUnits})+", "+ new java.text.DecimalFormat("#,##0").format($V{DormantUnitsTotal}) + " of the units on service contracts."]]></textFieldExpression>
            </textField>

并且有一个列在前十名的子报告: “e。前十大服务收入客户占”+ new java.text.DecimalFormat(“#,## 0%”)。格式($ V {PercentageTotal})+“服务收入,平均为”+新的java.text.DecimalFormat(“#,## 0%”)。格式($ V {PercentageHighRisk})+“高风险”类别中的服务收入。“

0 个答案:

没有答案