Jump to content

Report with Groups: Group-Calculation (sum) invalid in before pagebreak


samverner18

Recommended Posts

My Result-Set is as follows:

poSum poDate    yearweek employeeId
1    2022-01-04    2022/01    P85274824
2    2022-01-05    2022/01    P85274824
3    2022-01-06    2022/01    P85274824
4    2022-01-07    2022/01    P85274824
5    2022-01-10    2022/02    P85274824
6    2022-01-11    2022/02    P85274824
7    2022-01-12    2022/02    P85274824
8    2022-01-13    2022/02    P85274824
9    2022-01-14    2022/02    P85274824
10    2022-01-17    2022/03    P85274824
11    2022-01-18    2022/03    P85274824
12    2022-01-19    2022/03    P85274824
13    2022-01-20    2022/03    P85274824
14    2022-01-21    2022/03    P85274824
15    2022-01-24    2022/04    P85274824
16    2022-01-25    2022/04    P85274824
17    2022-01-26    2022/04    P85274824
18    2022-01-27    2022/04    P85274824
19    2022-01-28    2022/04    P85274824
20    2022-01-31    2022/05    P85274824


Group0: <groupFooter>groupExpression: poEmployeeId
Group1: groupExpression: poEmployeeId
Group2: groupExpression: yearweek
DataFields: poDate, poSum

poSum is Summarized for every group:

    <field name="poSum" class="java.lang.Double">
        <fieldDescription><![CDATA[poSum]]></fieldDescription>
    </field>

    <variable name="sumGroup1" class="java.lang.Double" resetType="Group" resetGroup="employeeId" calculation="Sum">
        <variableExpression><![CDATA[$F{poSum}]]></variableExpression>
    </variable>

    <variable name="sumGroup2" class="java.lang.Double" resetType="Group" resetGroup="kw" calculation="Sum">
        <variableExpression><![CDATA[$F{poSum}]]></variableExpression>
    </variable>

Groups are as follows:

    <group name="employeeId" isReprintHeaderOnEachPage="true">
        <groupExpression><![CDATA[$F{employeeId}]]></groupExpression>
        <groupFooter>
            <band height="14" splitType="Prevent">
                <textField textAdjust="StretchHeight" isBlankWhenNull="false">
                    <reportElement x="0" y="0" width="360" height="11" forecolor="#000000"/>
                    <textFieldExpression><![CDATA["nRow1nRow2nRow3nRow4nRow5"]]></textFieldExpression>
                </textField>
            </band>
        </groupFooter>
    </group>
    <group name="poMitarbeiterReId1" isStartNewPage="true" isReprintHeaderOnEachPage="true">
        <groupExpression><![CDATA[$F{employeeId}]]></groupExpression>
        <groupHeader>
            <band height="14">
                <textField textAdjust="StretchHeight" evaluationTime="Group" evaluationGroup="poMitarbeiterReId1" pattern="###0.00" isBlankWhenNull="false">
                    <reportElement  x="170" y="2" width="39" height="11"/>
                    <textFieldExpression><![CDATA[$V{sumGroup1}]]></textFieldExpression>
                </textField>
[..]
            </band>
        </groupHeader>
    </group>
    <group name="kw" isReprintHeaderOnEachPage="true">
        <groupExpression><![CDATA[$F{yearweek}]]></groupExpression>
        <groupHeader>
            <band height="14">
                <textField textAdjust="StretchHeight" evaluationTime="Group" evaluationGroup="kw" pattern="###0.00" isBlankWhenNull="false">
                    <reportElement  x="170" y="2" width="39" height="11"/>
                    <textFieldExpression><![CDATA[$V{sumGroup2}]]></textFieldExpression>
                </textField>
[..]
            </band>
        </groupHeader>
    </group>

 


All group-calculations (sum) are correct. But when tha page places the one element on the next page (page-break) the group-calculation is wrong.

The gruop values for the yearweek group:

Should be as follows

2022/01     10
2022/02     35
2022/03     60
2022/04     85
2022/05     20

But when the first produces a page-break placing only the groupFooter on the next page:

2022/05     85 <- displays the value from the prevous group.

 

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Switching Evaluation TextField from "Group" to "Report" displays the same value for every group.

Group-Sums are shown like this:

2022/01     20
2022/02     20
2022/03     20
2022/04     20
2022/05     20

Tried other evaluation times as well  - this has not solved the problem either.

Link to comment
Share on other sites

Thank you for the anwser.

I have reworked the report and completely removed the bands title, pageHeader and pageFooter. To keep the same layout, I have used Groups to display title, and column names. The problem remains unchanged.

I have simplified the report to show the problem more precise.

In the "real" report:
- The title band itself has variable height -> changing the height solves the problem
- The number of datarows itself can solve the problem. Adding/or removing (at least) one row -> solves the problem

Changing the height parameters will solve the problem in this situation. But the problem underneath remains ... only the case to revail will be different.

I want to provide the report that works correct all the time

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...