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

Last record on page in detail

edited July 2005 in RAP
Hi!

What way to detect, what record on the detail band is last on the page?

Thank you,
Nikolai Bochkarev

Comments

  • edited July 2005
    Hi Nikolai,

    Unfortunately there is not a good way to detect what record is the last on a
    page. If you are using a static height detailband, you can predetermine
    what the last record will be. Also you can try checking the
    DetailBand.OutOfSpace property to find out if a dynamic height band needs to
    break to the next page.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2005
    > what the last record will be. Also you can try checking the
    to

    Thank you!
    I'm try this way in my case with dynamic height band, but
    DetailBand.OutOfSpace
    always false!

    May be I can calculate last record on page event in Detail.BeforePrint band,
    but how to determinate real absolute position element of detail on Page?
    (ClientToScreen)
    I could, calculating, for example:

    if Detail.Line1.Top - Footer.Line2.Top < 10 {some small delta} then ...
    {Last record event!}

    {where Detail.Line1 - bottom line on detail band, and Footer.Line2 - upper
    line on Footer}

    But how to determinate real pos on page?
    Now Detail.Line1.Top always return local X pos on detail.

    Regards,
    Nikolai
  • edited July 2005

    Here is a Delphi code example that shows how to calc the remaining page
    space available. First work on a Delphi code solution and you can then adapt
    it for RAP by adding one or more custom functions (see article below).


    http://www.digital-metaphors.com/tips/CalcSpaceAvailable.zip

    --------------------------------------------------
    Article: Extending RAP
    ---------------------------------------------------

    There are two very simple and powerful techniques to extend the capabilities
    of RAP infinitely. These are summarized below and covered in more detail in
    the RAP.hlp online help. Demos and tutorials are installed to
    RBuilder\Demos\RAP. The tutorial text is located in RAP.hlp.


    1. RAP Pass-Through Functions

    These are functions that appear in the Language tab of RAP's Code Toolbox.
    These functions are written in Delphi and can be called from RAP. RAP's
    pass-through function architecture enable's developers to add new built-in
    functions to RAP's code toolbox.

    2. Extend RAP's RTTI

    RAP's Run-time Type information defines what classes and properties can be
    accessed via RAP. By default the published properties of any class that is
    registered with Delphi's RegisterClass procedure is recognized by RAP. In
    addition many of the public properties and methods of ReportBuilder classes
    are exposed.







    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com

    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2005
    > Here is a Delphi code example that shows how to calc the remaining page



    thank you!!!
    all work ok!

    TEcosoftFunction = class (TraSystemFunction)
    public
    class function Category: String; override;
    end;


    TGetPageSpaceFunction = class (TEcosoftFunction)
    public
    procedure ExecuteFunction(aParams: TraParamList); override;
    class function GetSignature: String; override;
    end;

    ...

    class function TEcosoftFunction.Category: string;
    begin
    Result := 'Lexema';
    end;

    procedure TGetPageSpaceFunction.ExecuteFunction(aParams: TraParamList);
    var
    Report: TppReport;
    liSpaceAvailableInMicrons: Integer;
    lfSpaceAvailabeInReportUnits: Extended;
    begin
    GetParamValue(0, Report);
    liSpaceAvailableInMicrons := Report.Engine.PageBottom -
    Report.Engine.PrintPosRect.Top;
    lfSpaceAvailabeInReportUnits :=
    ppFromMMThousandths(liSpaceAvailableInMicrons, Report.Units, pprtVertical,
    Report.Printer);
    SetParamValue(1, lfSpaceAvailabeInReportUnits);
    end;

    class function TGetPageSpaceFunction.GetSignature: string;
    begin
    Result := 'function GetPageSpace(var Report: TppReport): Extended;';
    end;

    ..
    raRegisterFunction('GetPageSpace', TGetPageSpaceFunction);

    With best regards,
    Nikolai
This discussion has been closed.