Jump to content
  • 2 column report as subreport issue


    itchytoes
    Assigned User teodord
    CategoryBug report
    PriorityNormal
    ReproducibilityAlways
    ResolutionFixed
    SeverityMinor
    StatusClosed

    I submitted the following to the forum, and it was suggested that I enter it as a bug:

     

     

    I have a subreport that has 2 columns, and the way the data falls will make the first column shorter than the 2nd column because the 2nd column has more rows in its group. (I use a group with isStartNewColumn="true") to get the 2nd column started.

     

    When I run the report by itself, it is fine. When I run it as a subreport, the subreport ends up generating one more page because it makes the 2nd column the same height as the first column and the remaining extra rows ends up on the first column of a new page.

     

    I can split this into 2 subreports (one for each column on the main report), but I would prefer to just have one subreport with one query.

     

     

     


    Attachments: tojasper.zip

    User Feedback

    Recommended Comments

     

    Hi,

     

    Instead of using isStartNewColumn="true" for your group, put a element at the top of the group header. This way, the subreport will consume all the available space on the current page.

     

    I hope the result is what you expect.

    Teodor

     

    Link to comment
    Share on other sites

    I am not sure how to do the suggestion for my particular case. I do have a groupHeader, but the groupHeader band has a so that it is printed only for the first column. The second column would not have a group header at all.

     

    So, I tried putting a into the groupFooter, and included a printWhenExpression for doing it only at the end of the first column.

     

    The report by itself works fine, but as a subreport, I get one extra blank page at the end.

    Link to comment
    Share on other sites

     

    If you cannot use the existing groupHeader, due to the , you can duplicate the group (create a new group using the same group expression) and use the group header section of that one.

    Note that the new group should be the parent of the existing group (should be a higher level group that contains the existing group).

     

    I hope this helps.

    Teodor

     

    Link to comment
    Share on other sites

    I duplicated the group as suggested and put the in the groupHeader for this duplicated group, and it works fine in that I get the correct column break. However, once again, I end up with an extra blank page at the end of my report. (My report should be 2 pages and I end up with 3). The subreport run by itself is only one page, but somehow making it a part of the other report results in that annoying extra blank page.

     

    The only way to have it work is my original method of doing each of the 2 columns as a separate subreport, which does go a little slower.

     

     

    Link to comment
    Share on other sites

    Hi --

     

    Hmm. let me see -- my actual example is quite complex and requires my database, also complex.

     

    Let me see if I can adjust one of the sample reports to do the same thing.

     

    Link to comment
    Share on other sites

    Hi -- Okay -- I am attaching a MainReport.jrxml and a Subrepot.jrxml that illustrates the problem.

     

    It does use Oracle database queries where I "select ... from dual" so you don\'t need DB tables, but you do need an Oracle DB. Of course, you can change the datasource or whatever. I was too lazy to try to do any other kind of datasource.

     

    The Subreport run by itself is one page. The MainReport with Subreport should be 2 pages. It is three.

     

    This example is interesting in that I added some which appears before the column break, and you can see this text appear on the last page 3. This text appears twice when running the MainReport, but it appears only once (as I believe it should) when the Subreport is run by itself.

    Link to comment
    Share on other sites

    Hi,

     

    The 3rd empty page comes from what we call "overflow with empty space".

    In the master report, change the dummygroupFooter band height to 735 instead of 750, so that no blank space remains after the subreport.

    The extra page should disappear.

     

    I hope this helps.

    Teodor

     

    Link to comment
    Share on other sites

    Hi -- Okay, I changed the 750 to 735 for my test case, and that does indeed fix the problem. I now get the 2 pages only.

     

    I\'m just a little unclear on where the 735 comes from. My subreport pageheight is 660 with no top/bottom margins, and my for the subreport is 650, so where does 735 come from?

     

    I do see a lot of postings on the forum about people having trouble with blank pages appearing as a result of using subreports.

    Link to comment
    Share on other sites

    Hi,

     

    Your subreport element height is 650, but it is placed at y=85.

    650 + 85 = 735

    The page height of the subreport does not matter when embedded into another report. It matters only when subreport runs standalone.

     

    I\'m closing this.

     

    Thank you,

    Teodor

     

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