Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

NewPageThreshold problem

edited September 2006 in General
D7Ent, RB7.04

1) I'm trying to debug a problem with NewPageThreshold - is there a way to
determine how much "printable space" is left on a page?

I'm setting NewPageThreshold at run time, and every once in awhile I get
something on the bottom of the page that shouldn't be there...

2) I set NewPageThreshold in a BeforeGroupBreak event for the "top" group
([0]). Depending on the data, a following group will contain data and titles
for the detail band. Something like

Group0 Header-------------
Data Fields
Group1 Header-------------
[rgn for Group1 column titles]
[rgn for Group1 data]
[rgn for Detail Band column titles]
Detail Band-----------------
Detail fields
Group0 Footer-------------

In Group0 BeforeGroupBreak I set the NewPageThreshold to:
Group0 Footer Height + // (A)
Group0 Header Height + // (B)
Group1 rgn column title Height + // (C)
Group1 rgn data height // (C)

If then also add
Group1 rgn for Detail Band Column titles height + //(D)
Detail Band Height // (D)

(A) is added because we're at the end of the page - there's always at least
one previous group
(B) we need room for the header (can't use "0" because there are other bands
to add in
(C) if we trigger group0, there will always be a group1 - reserve space for
titles and one row of data
(D) if there are details, reserve space for titles and at least one row of
details

Every once in awhile I get the Group0 header all by itself with a bunch of
white space below (can't tell if actually enough room to print Group1 header
and (when needed) detail band.

Am I missing something?

TIA.

Cheers,
EdB

Comments

  • edited September 2006
    Hi EdB,

    The best way to determine where you are on the page is to use the
    PrintPosRect property of the Report.Engine. The bottom of this rectangle
    represents the current position on the page the report has spanned.

    Another option would be to keep all your components inside the group header
    in a region with KeepTogether set to True. This will keep the group header
    from printing on two pages.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2006
    Thanks - I'll check out "PrintPosRect" and see what I find.

    BTW - if NewPageThreshold is "0" - I assume that the group internally uses
    the height of band header in question. When I set NewPageThreshold to
    something (say 0.5) - does the internal calculation ignore the band height
    and just use 0.5 even if the band height is greater than 0.5?

    WRT "KeepTogether" - unfortunately the issue isn't that any single group
    header spans two pages, it's that I have a Group[0] header that I don't want
    to print by itself if the Group[1] header won't also fit at the bottom of
    the page. Adding to this, my detail band is "optional" - I have to consider
    the height of the column titles and detail band...

    I'm printing manufacturing work order information eg:
    WOno 1
    OperationNo 1
    Material 1
    Material 2
    OperationNo 2
    OperationNo 3
    WOno 2
    OperationNo 1
    OperationNo 2
    Material 1
    Material 2
    OperationNo 3

    Column titles are also displayed (or turned off for n+1 sequential rows of
    material or Operations).

    So, sometimes I have WONo-OperationNo with no material - which means my
    threshold for WONo break is :
    WONoBandHeader.height + OperationTitles.height + OperationNo.height ;

    Sometimes I have WONo-OperationNo-Material - which means my threshold for
    WONo break is:
    WONoBandHeader.height + OperationTitles.height + OperationNo.height +
    MaterialTitles.Height+Material.height;

    Any suggestion on a better way to handle this than recalculating
    NewPageThreshold on every break condition?

    (It gets worse - I have to reprint the WONo header within the body of
    sequential Operations under special conditions (I handle this by flagging a
    record in the data, inserting a group between WONo and OperationNo, and
    controlling display of the group based on the data flag...)


    Cheers,
    EdB
  • edited September 2006
    >BTW - if NewPageThreshold is "0" - I assume that the group internally uses

    No, the NewPageThreshold defines the amount of space available below the
    bottom of the group header. If the header band is larger than the space
    available, it will of course break to a new page. If you set the
    NewPageThreshold to 0.5 and there is room for the header to fit, the detail
    bands will not print if there is less than 0.5 (inches, mm, etc.) available
    under the header.
    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.