Home Subreports

Pages printing only Header and Footer info - preview has data

edited August 2003 in Subreports
I have a report w/ (15) Child Subreports and (3) RBAddOns hard Pagebreaks.

An example of my problem is this:

When my report is generated it is first previewed and the data looks and
paginates OK going in the forward viewing direction. If I try and go
backwards in the viewer I get blank data pages (headers and footers only)
and some of the page broken data going forward is wrongly paginated.

Also, when I try to print a current page or range of pages, pagination is
skewed and I don't get what is previewed.

I have tried both one-pass and two-passes to see if this would fix the
problem but the results are the same for both.

Any help would be greatly appreciated.

I am using D5, RB6.03, RBAddON.

Thanks

Bill Lawler
Elite Brokerage Services, Inc

Comments

  • edited August 2003
    If you take out the page break component does it begin working correctly?
    Try using a group object to force a page break as shown in this article:


    Cheers,

    Jim Bennett
    Digital Metaphors

    ---------------------------------------------
    Article: Forcing a Page Break
    ---------------------------------------------

    Question:

    How can I force a page break occur based upon
    a condition calculated at run-time.

    2 of the best solutions follow:

    Solution 1:

    Define a Group that starts on a new page when
    it breaks. Then use the Group.OnGetBreakValue
    event to control the timing of the break.

    1. From the Report Designer, select Report | Groups
    to access the Group dialog.

    2. Define a group based upon a static component,
    such as a Label or Variable. Click the
    Start new page checkbox. Close the dialog.

    3. Using the object inspector's drop down list,
    find and select the TppGroup object.

    4. Create an event-handler for the Group's
    OnGetBreakValue event.

    5. Add code to set the break value.


    procedure Form1.Group1OnGetBreakValue(Sender: TObject; var aBreakValue:
    String);
    begin

    if condition then
    aBreakValue := 'Some Value';

    end;


    Solution 2:

    1. Place a subreport at the point where you might want a page break.

    2. Remove its summary band and reduce the height of its detail and
    title bands to zero.

    By programmatically setting the title band's NewPage property you can
    conditionally force a page break. Note that everything after the
    subreport that is in the same band with it will need to
    ShiftRelativeTo the subreport.


    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com
  • edited August 2003
    Jim:

    I tried Option #2 and it worked great for one of the 3 situations I have.
    The other 2 breaks I would want to occur only if there was data in the 2
    tables to print.
    How would I test for a non-empty DBPipeline in RB?
    Would just a Delphi test for EOF or recordcount work just as well?

    Thanks again

    Bill

  • edited August 2003
    You can check if ppdaNoRecords in DataPipeline.State. Add ppTypes to the
    uses clause to reference the ppdaNoRecords enumeration.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2003
    Jim:

    I put the code in for testing of ppdaNoRecords in DataPipeline.State but
    the logic fell through.

    The issue is the pipeline itself is not empty but the master for this
    subreport has no detail records (confirmed). Does that change the property
    or method of evaluation.?

    Thanks again. I'm almost there.

    Bill Lawler

  • edited August 2003
    Hi Bill,

    If the detail has no records, then if you want to print the master anyway,
    then set the detail datapipeline's SkipWhenNoRecords property to false.
    Perhaps the state isn't set, the engine can simply check if there are
    records and then check the SkipWhenNoRecords property. What is the value of
    state when you hit this case? It probably is not EOF. Since the master and
    detail are both on the proper records (even though the detail is the detail
    for the next master) you can check if the key field value for each
    pipeline's current value is matching. If they don't match then there is no
    detail for this master. That would be one way to try it.




    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2003
    Jim:

    Checking the detail against the master like this did the trick:

    if (DataModule2.NRSCDMemo.FieldbyName('Case_Id').asString =
    DataModule2.NRSCDStub.FieldbyName('Case_Id').asString) and
    (DataModule2.NRSCDMemo.FieldbyName('Policy_Eff').asString =
    DataModule2.NRSCDStub.FieldbyName('Policy_Eff').asString) then
    else
    begin
    ForcedPageBreak2.Visible := false; // this is the blank subreport
    example for pagebreak
    ppSubReport11.Visible := false;
    ForcedPageBreak3.ShiftRelativeTo := ppSubReport9;
    end;

    Thanks again for your thoughts!

    Bill Lawler

This discussion has been closed.