Jump to content
Changes to the Jaspersoft community edition download ×

ignore pagination for subreports


aanderso

Recommended Posts

I have an upper level report, say Report A, that contains only a subreport. I have set the ignore pagination flag to false in the designer (XML). The subreport, say subreport B, contains only 5 subreports, but not all 5 may appear depending on the print When  expression. Subreport B has the XML  ignore paginate flag set to true so that all the subreports on B appear on one "page".

At runtime the whole report seems to run without pagination for the display (we use a viewer class to view the report, then exporters for PDF, etc.). When it prints, however, it puts out a blank first page and everything paginates and there is no break on the group field.

For Report A, we have something like this:

<... snip ...>

<jasperReport name="FAReserveSingleBaseSubRpt" pageWidth="791" pageHeight="612" orientation="Landscape"    columnWidth="791" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="false">
    <parameter name="reporttype" class="java.lang.String" isForPrompting="false"/>
    <parameter name="forDate" class="java.lang.String" isForPrompting="false"/>
    <parameter name="sections" class="java.lang.String" isForPrompting="false"/>
    <parameter name="reportPath" class="java.lang.String" isForPrompting="false"/>
    <parameter name="printAirportStandby" class="java.lang.String" isForPrompting="false">
<... snip...>

    <detail>
        <band height="50">
            <subreport isUsingCache="false">
                <reportElement stretchType="RelativeToTallestObject" x="3" y="2" width="755" height="43" isPrintWhenDetailOverflows="true"/>

                <... snip ...>
                <subreportParameter name="reportDate"/>
                <subreportParameter name="base"/>
                <subreportParameter name="printAirportStandby"/>
                <subreportParameter name="sections"/>
                <subreportParameter name="forDate"/>
                <subreportParameter name="ending"/>
                <subreportParameter name="schedPeriod"/>
                <subreportParameter name="reporttype"/>
                <subreportParameter name="beginning"/>
                <subreportParameter name="position"/>
                <dataSourceExpression><![CDATA[$F{baseSubRptList}]]></dataSourceExpression>
                <subreportExpression class="java.lang.String"><![CDATA["crewreports/definition/FAReserveSingleBaseSubRpt.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </detail>

On Report B, we have:

<jasperReport name="FAReserveSingleBaseSubRpt" pageWidth="791" pageHeight="612" orientation="Landscape" columnWidth="791" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true">
    <property name="com.jasperassistant.designer.Grid" value="false"/>
    <property name="com.jasperassistant.designer.SnapToGrid" value="false"/>
    <property name="com.jasperassistant.designer.GridWidth" value="12"/>
    <property name="com.jasperassistant.designer.GridHeight" value="12"/>
    <parameter name="printAirportStandby" class="java.lang.String" isForPrompting="false"/>
    <parameter name="printUnassigned" class="java.lang.String" isForPrompting="false"/>
    <parameter name="printDeparting" class="java.lang.String" isForPrompting="false"/>
    <parameter name="printReturningToBase" class="java.lang.String" isForPrompting="false"/>
    <parameter name="printReturningOOB" class="java.lang.String" isForPrompting="false"/>
    <field name="airportStandBySubRptList" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
    <field name="unassignedSubRptList" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
    <field name="departingSubRptList" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
    <field name="returningToBaseSubRptList" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
    <field name="returningOutOfBaseSubRptList" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
    <detail>
        <band height="225">
            <subreport isUsingCache="false">
                <reportElement x="2" y="2" width="744" height="33"/>
                <dataSourceExpression><![CDATA[$F{airportStandBySubRptList}]]></dataSourceExpression>
                <subreportExpression class="java.lang.String"><![CDATA["crewreports/definition/FAReserveRptAirportStandBySubRpt.jasper"]]></subreportExpression>
            </subreport>
            <subreport isUsingCache="false">
                <reportElement positionType="Float" x="1" y="45" width="744" height="33"/>
                <dataSourceExpression><![CDATA[$F{unassignedSubRptList}]]></dataSourceExpression>
                <subreportExpression class="java.lang.String"><![CDATA["crewreports/definition/FAReserveRptUnassignedSubRpt.jasper"]]></subreportExpression>
            </subreport>
            <subreport isUsingCache="false">
                <reportElement positionType="Float" x="2" y="88" width="744" height="33"/>
                <dataSourceExpression><![CDATA[$F{departingSubRptList}]]></dataSourceExpression>
                <subreportExpression class="java.lang.String"><![CDATA["crewreports/definition/FAReserveRptDepartingSubRpt.jasper"]]></subreportExpression>
            </subreport>
            <subreport isUsingCache="false">
                <reportElement positionType="Float" x="2" y="131" width="744" height="33"/>
                <dataSourceExpression><![CDATA[$F{returningToBaseSubRptList}]]></dataSourceExpression>
                <subreportExpression class="java.lang.String"><![CDATA["crewreports/definition/FAReserveRptReturningToBaseSubRpt.jasper"]]></subreportExpression>
            </subreport>
            <subreport isUsingCache="false">
                <reportElement positionType="Float" x="2" y="175" width="744" height="33">
                    <printWhenExpression><![CDATA[new Boolean($P{printReturningOOB} == "Y")]]></printWhenExpression>
                </reportElement>
                <dataSourceExpression><![CDATA[$F{returningOutOfBaseSubRptList}]]></dataSourceExpression>
                <subreportExpression class="java.lang.String"><![CDATA["crewreports/definition/FAReserveRptReturningOutOfBaseSubRpt.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </detail>
</jasperReport>
 

shouldn't the xml cause jasper to print paginated pages (Report A) of unpaginated pages (Report B)?

 

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

aanderso
Wrote:

shouldn't the xml cause jasper to print paginated pages (Report A) of unpaginated pages (Report B)? 

You'll need to explain what paginated pages of unpaginated pages means.

In any case, pagination is controlled by the master report.  So setting isIgnorePagination="true" for a subreport doesn't make sense.

Regards,

Lucian

Link to comment
Share on other sites

Thanks for the response... it doesn't seem to make sense, but it does for what they want.

For display purposes, each of the upper-level sub-reports represents a base. Each base has multiple sub-reports,and should be displayed as a single scrollable page (unpaginated). So, they can see all the subreports for that base on the same scrollable "page". For print (and file saving/export) purposes, it must page/print as normal, otherwise all of one base would be squeezed onto a single page, thus too small to read (I tried this for PDF, and it is unreadable if there are many entries for the base subreports).

Each of the subreports is a JRBeanCollectionDataSource of its own, and has different data format and titles.

I tried putting the base field into the upper level report, and breaking on that field to a new "page", but if it is unpaginated, it effectively means nothing; if it is paginated, it does not display properly due to the restriction you mentioned on the master report. I saw that in the code, but was hoping there was some way around it. Also, I tried a number of other scenarios, and either it pages normally (not what they want), the master report title does not appear on pages properly (yes, I checked/changed the properties), or it seemed to implode and gave me a mashup of unacceptable (to our customer) output.

Thanks again for a great product and support! I love Jasper, and would like to contribute to the effort at the point where I feel competent enough to do so.

Link to comment
Share on other sites

At the moment, you can't have pages of different lengths in a single report.  Also, pagination is performed at report fill time, so you can't have a non-paginated report and paginate it at export time.

With some effort, you might still be able to do something though the result will probably not be exactly what you expect.  How do you intend to display the unpaginated reports?

Link to comment
Share on other sites

One of the other programmers did manage to get all the pages for a single base to paginate together, and for each to be on a separate page. He did this by waiting until fillReport came back for each base, then appending to the already display-formatted report(s) by adding to the 'pages' list. The upper-level report had IGNORE_PAGINATION=FALSE, so it "broke" on each base.

As you can imagine, this messed up the print and export, but the display worked fine. That is, all of one base scrolled as it should have in the display on the CRT, but exporting them exported the same way: pages with lots of data were too small to be read because each entire page [base] was scaled onto one physical page. Ditto the printing.

What we really wanted to accomplish was to make the display work differently than export or print. At first, I thought I'd just make a main report that contained one subreport for each base -- as if we were going to page break on the base field. That subreport would contain only the other 5 sub-reports. It quickly became apparent that this was not working, and I struggled to find out why. I did noticed that there did not seem to be any way to set pagination at run time. When I traced into the Jasper code, it was immediately obvious from one of your comments -- as well as the code -- that the upper level report would determine paging.

A final question: How does one earn karma? I have replied to a couple of posts from others, but I do not know if that counts toward karma.

Thanks again, Lucien.

 



Post Edited by aanderso at 07/07/2010 06:17



Post Edited by aanderso at 07/07/2010 06:18
Link to comment
Share on other sites

aanderso
Wrote:

A final question: How does one earn karma? I have replied to a couple of posts from others, but I do not know if that counts toward karma.

Karma points are explicitly awarded by other users (see the + and - buttons).

Regards,

Lucian

Link to comment
Share on other sites

  • 5 months later...

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...