By: MLA - dozylocal
Subreport splitting
2005-02-01 06:49
Hi
I've posted about this before. I thought I'd solved the problem but it seems I haven't totally.
For those who missed the first post: I have a main report that contains four subreports in its group footer.
The first subreport position is set to "FixRelativeToTop" and the rest
are set to "Float"
Each subreport consists of a single group with some tabular
information in the detail section and a corresponding graph in the
group-footer (split = false).
The desired report layout should thus be as follows:
MAIN REPORT
<Main report info>
SUB-REPORT 1
<Sub report info>
<Sub report 1 graph>
SUB-REPORT 2
<Sub report info>
<Sub report 2 graph>
SUB-REPORT 3
<Sub report info>
<Sub report 3 graph>
SUB-REPORT 4
<Sub report info>
<Sub report 4 graph>
END MAIN REPORT
The problem is that the middle two subreports are not displaying correctly.
They are displaying as:
<Sub report 2 data>
<Sub report 3 title>
<sub report 2 graph>
<Sub report 3 data>
<Sub report 3 graph>
It seems like the graph for the second subreport is getting "confused" or something. Could this be as a result of them all being set to "float"?
The xml for the group footer containing my subreports is as follows:
<groupFooter>
<band height="154" isSplitAllowed="true">
<subreport isUsingCache="false">
<reportElement mode="Opaque" x="1" y="0" width="532" height="37" forecolor="#000000" backcolor="#FFFFFF" key="subreport-1" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="false" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false">
<printWhenExpression><![CDATA[(new Boolean(($V{weight_statDS}) != null))]]></printWhenExpression>
</reportElement>
<dataSourceExpression><![CDATA[$V{weight_statDS}]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA["Weight_Sub.jasper"]]></subreportExpression>
</subreport>
<subreport isUsingCache="false">
<reportElement mode="Opaque" x="1" y="39" width="532" height="37" forecolor="#000000" backcolor="#FFFFFF" key="subreport-2" stretchType="NoStretch" positionType="Float" isPrintRepeatedValues="false" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false">
<printWhenExpression><![CDATA[(new Boolean(($V{viralLoad_testDS}) != null))]]></printWhenExpression>
</reportElement>
<dataSourceExpression><![CDATA[$V{viralLoad_testDS}]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA["ViralLoad_Sub.jasper"]]></subreportExpression>
</subreport>
<subreport isUsingCache="false">
<reportElement mode="Opaque" x="1" y="78" width="532" height="37" forecolor="#000000" backcolor="#FFFFFF" key="subreport-3" stretchType="NoStretch" positionType="Float" isPrintRepeatedValues="false" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false">
<printWhenExpression><![CDATA[(new Boolean(($V{CD4_testDS}) != null))]]></printWhenExpression>
</reportElement>
<dataSourceExpression><![CDATA[$V{CD4_testDS}]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA["CD4_Sub.jasper"]]></subreportExpression>
</subreport>
<subreport isUsingCache="false">
<reportElement mode="Opaque" x="1" y="117" width="532" height="37" forecolor="#000000" backcolor="#FFFFFF" key="subreport-4" stretchType="NoStretch" positionType="Float" isPrintRepeatedValues="false" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false">
<printWhenExpression><![CDATA[(new Boolean(($V{drugRecordDS}) != null))]]></printWhenExpression>
</reportElement>
<dataSourceExpression><![CDATA[$V{drugRecordDS}]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA["Prescription_Sub.jasper"]]></subreportExpression>
</subreport>
</band>
</groupFooter>
Please help. This is extremely frustrating!
Thanks :-)
Mya
By: Mike Warne - mwarne
RE: Subreport splitting
2005-02-04 18:39
Have you tried to divide the subreports into separate dummy groups? The groups should always print in the proper order, so that may solve your problem
By: MLA - dozylocal
RE: Subreport splitting
2005-02-06 21:54
No I haven't. I want to but i'm not too sure how to get the dummy groups to fire and I'm struggling to find examples. I don't really have a field I can use so would prefer to use some kind of variable, but am not sure how to do this and all my attempts thus far haven't been very successful.
Thanks for the suggestion :-)
Mya
By: C-Box - c-box
RE: Subreport splitting
2005-02-07 00:14
For DummyGroups you can use empty expressions.... just leave the expression blank.
Of course you can also create some "nonsens" expressions like "new Integer(1)" for the first dummygroup, "new Integer(2)" for the second dummygroup.... and so on...
hth
C-Box
By: MLA - dozylocal
RE: Subreport splitting
2005-02-07 00:32
Thanks :)
I'll try that. Hopefully it will fix my problem.
By: MLA - dozylocal
RE: Subreport splitting
2005-02-07 01:58
Tried putting each subreport into it's own group. Initially, the groups did not have an expression but that wasn't working so I also tried have "new Integer(1), new Integer(2)" etc as dummy group expressions.
In both cases, the subreports did not display.
Please help! :-)
Mya
By: MLA - dozylocal
RE: Subreport splitting
2005-02-09 02:22
Still struggling to get the subreports to display if I put them in different bands, but on a different note - I was wondering if this was a bug?
As soon as I only have three reports (set to "Float), they appear fine. When I add the fourth, then the second one splits itself (but not all the time).
Any suggestions?
By: C-Box - c-box
RE: Subreport splitting
2005-02-09 02:28
What height does you set for the SubReports Elements?
Try to set their height to 1 pixel and set the removeLineWhenBlank.
Like I said, I have also more than 3 subreports within a masterReport and even use nested SubReports and didn't get any trouble (btw. I'm still using jasperreports 0.6.1 because I'm still developing a massive-compile-like tool that verify my fields on current class-definition and also compiles after that.) So I just upgrade to 0.6.4 when I finished this... perhaps your case is really a bug of JasperReports.
Have you already tried to send a sample towards Teodor?
C-Box
By: MLA - dozylocal
RE: Subreport splitting
2005-02-09 03:51
I tried setting the height to 1, but that didn't help either :(
The first three subreports are not displaying in the dummy groups because the datasources are only being set at the end of the main (person) group. This is because I have to build up the datasource as the report iterates over the bean objects (each object contains a list of objects that must all be built into one datasource for the respective subreport).
I still find it odd that it is splitting the subreport itself.
Thanks for your help.
By: MLA - dozylocal
RE: Subreport splitting
2005-02-09 04:25
UPDATE:
I managed to get one dummy group working so I moved the first two subreports into the dummy-footer (set to "FixRelativeToTop" and "Float" respectively) and left the second two where they were in the main group footer (same positions) and it seems to be working now...
Subreport splitting
2005-02-01 06:49
Hi
I've posted about this before. I thought I'd solved the problem but it seems I haven't totally.
For those who missed the first post: I have a main report that contains four subreports in its group footer.
The first subreport position is set to "FixRelativeToTop" and the rest
are set to "Float"
Each subreport consists of a single group with some tabular
information in the detail section and a corresponding graph in the
group-footer (split = false).
The desired report layout should thus be as follows:
MAIN REPORT
<Main report info>
SUB-REPORT 1
<Sub report info>
<Sub report 1 graph>
SUB-REPORT 2
<Sub report info>
<Sub report 2 graph>
SUB-REPORT 3
<Sub report info>
<Sub report 3 graph>
SUB-REPORT 4
<Sub report info>
<Sub report 4 graph>
END MAIN REPORT
The problem is that the middle two subreports are not displaying correctly.
They are displaying as:
<Sub report 2 data>
<Sub report 3 title>
<sub report 2 graph>
<Sub report 3 data>
<Sub report 3 graph>
It seems like the graph for the second subreport is getting "confused" or something. Could this be as a result of them all being set to "float"?
The xml for the group footer containing my subreports is as follows:
<groupFooter>
<band height="154" isSplitAllowed="true">
<subreport isUsingCache="false">
<reportElement mode="Opaque" x="1" y="0" width="532" height="37" forecolor="#000000" backcolor="#FFFFFF" key="subreport-1" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="false" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false">
<printWhenExpression><![CDATA[(new Boolean(($V{weight_statDS}) != null))]]></printWhenExpression>
</reportElement>
<dataSourceExpression><![CDATA[$V{weight_statDS}]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA["Weight_Sub.jasper"]]></subreportExpression>
</subreport>
<subreport isUsingCache="false">
<reportElement mode="Opaque" x="1" y="39" width="532" height="37" forecolor="#000000" backcolor="#FFFFFF" key="subreport-2" stretchType="NoStretch" positionType="Float" isPrintRepeatedValues="false" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false">
<printWhenExpression><![CDATA[(new Boolean(($V{viralLoad_testDS}) != null))]]></printWhenExpression>
</reportElement>
<dataSourceExpression><![CDATA[$V{viralLoad_testDS}]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA["ViralLoad_Sub.jasper"]]></subreportExpression>
</subreport>
<subreport isUsingCache="false">
<reportElement mode="Opaque" x="1" y="78" width="532" height="37" forecolor="#000000" backcolor="#FFFFFF" key="subreport-3" stretchType="NoStretch" positionType="Float" isPrintRepeatedValues="false" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false">
<printWhenExpression><![CDATA[(new Boolean(($V{CD4_testDS}) != null))]]></printWhenExpression>
</reportElement>
<dataSourceExpression><![CDATA[$V{CD4_testDS}]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA["CD4_Sub.jasper"]]></subreportExpression>
</subreport>
<subreport isUsingCache="false">
<reportElement mode="Opaque" x="1" y="117" width="532" height="37" forecolor="#000000" backcolor="#FFFFFF" key="subreport-4" stretchType="NoStretch" positionType="Float" isPrintRepeatedValues="false" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false">
<printWhenExpression><![CDATA[(new Boolean(($V{drugRecordDS}) != null))]]></printWhenExpression>
</reportElement>
<dataSourceExpression><![CDATA[$V{drugRecordDS}]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA["Prescription_Sub.jasper"]]></subreportExpression>
</subreport>
</band>
</groupFooter>
Please help. This is extremely frustrating!
Thanks :-)
Mya
By: Mike Warne - mwarne
RE: Subreport splitting
2005-02-04 18:39
Have you tried to divide the subreports into separate dummy groups? The groups should always print in the proper order, so that may solve your problem
By: MLA - dozylocal
RE: Subreport splitting
2005-02-06 21:54
No I haven't. I want to but i'm not too sure how to get the dummy groups to fire and I'm struggling to find examples. I don't really have a field I can use so would prefer to use some kind of variable, but am not sure how to do this and all my attempts thus far haven't been very successful.
Thanks for the suggestion :-)
Mya
By: C-Box - c-box
RE: Subreport splitting
2005-02-07 00:14
For DummyGroups you can use empty expressions.... just leave the expression blank.
Of course you can also create some "nonsens" expressions like "new Integer(1)" for the first dummygroup, "new Integer(2)" for the second dummygroup.... and so on...
hth
C-Box
By: MLA - dozylocal
RE: Subreport splitting
2005-02-07 00:32
Thanks :)
I'll try that. Hopefully it will fix my problem.
By: MLA - dozylocal
RE: Subreport splitting
2005-02-07 01:58
Tried putting each subreport into it's own group. Initially, the groups did not have an expression but that wasn't working so I also tried have "new Integer(1), new Integer(2)" etc as dummy group expressions.
In both cases, the subreports did not display.
Please help! :-)
Mya
By: MLA - dozylocal
RE: Subreport splitting
2005-02-09 02:22
Still struggling to get the subreports to display if I put them in different bands, but on a different note - I was wondering if this was a bug?
As soon as I only have three reports (set to "Float), they appear fine. When I add the fourth, then the second one splits itself (but not all the time).
Any suggestions?
By: C-Box - c-box
RE: Subreport splitting
2005-02-09 02:28
What height does you set for the SubReports Elements?
Try to set their height to 1 pixel and set the removeLineWhenBlank.
Like I said, I have also more than 3 subreports within a masterReport and even use nested SubReports and didn't get any trouble (btw. I'm still using jasperreports 0.6.1 because I'm still developing a massive-compile-like tool that verify my fields on current class-definition and also compiles after that.) So I just upgrade to 0.6.4 when I finished this... perhaps your case is really a bug of JasperReports.
Have you already tried to send a sample towards Teodor?
C-Box
By: MLA - dozylocal
RE: Subreport splitting
2005-02-09 03:51
I tried setting the height to 1, but that didn't help either :(
The first three subreports are not displaying in the dummy groups because the datasources are only being set at the end of the main (person) group. This is because I have to build up the datasource as the report iterates over the bean objects (each object contains a list of objects that must all be built into one datasource for the respective subreport).
I still find it odd that it is splitting the subreport itself.
Thanks for your help.
By: MLA - dozylocal
RE: Subreport splitting
2005-02-09 04:25
UPDATE:
I managed to get one dummy group working so I moved the first two subreports into the dummy-footer (set to "FixRelativeToTop" and "Float" respectively) and left the second two where they were in the main group footer (same positions) and it seems to be working now...
0 Answers:
No answers yet