Home RAP

Skipping records

edited May 2003 in RAP
Is it possible to skip special records with RAP?

Thanks,
Juergen.

Comments

  • edited May 2003
    Yes, but you'll need to create a RAP pass through function. See the main
    reports demo project. Report #116 skips records. However, it calls the
    SkipBack method on the pipeline and this isn't surfaced in RAP. Probably the
    best thing to do is create two RAP pass though functions to SkipForward and
    SkipBackward. Pass the datapipeline as a parameter of the function. There
    are examples of creating RAP pass thorugh functions in the installation in
    the Demos\Rap directory. There are also tutorials in the RAP.hlp file and in
    the Developer's Guide PDF on pass through functions.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited May 2003
    I have been trying to find a way to do this, as well, without setting the
    Detail Band visible to False. I tried making the passthrough functions for
    the SkipForward and SkipBackward. Is there a way to have the evaluation of
    whether the record should be skipped in RAP instead of hidden inside the
    passthough function? I tried the DetailBeforeGenerate but that only lets you
    skip one record at a time. So if there are more that one "skippable" records
    in a row, the second one is displayed because the DetailBeforeGenerate is
    not fired again.

  • edited May 2003
    Ok, what you'll have to do is create a new class. Register this class so
    that RAP can use RTTI to use its published properties. This class is going
    to be a TppCommunicator descendent. Now, the goal is to listen to event
    using the communicator rather than the delphi evnet handlers you are used
    to. In the RAP global OnCreate you should create this communicator and free
    it in the OnDestroy. You'll make a call to your pass through function in the
    global OnCreate event after you create this new object.

    In your RAP pass through function, pass this object as a parameter and also
    the data pipeline. Now in the RAP pass through code in Delphi, you can hook
    up the event notification relationship by calling
    DataPipeline.AddEventNotify(MyCommunicatorObject). Then in your communicator
    object, override the EventNotify method and create a case statement on the
    aEventID parameter. Check for ciPipelineFirst, ciPipelineLast,
    ciPipelineNext, ciPipelinePrior. These are the notifications that are sent
    at the same time the Delphi event handlers are triggered. ppTypes will need
    to be in your uses clause.

    So, by using a communicator object, you can perform the 4 calls to the two
    skip routines in the class. All that has to be done in RAP is surface your
    new class type and to make a new pass through function that uses this class
    to initialize it with the pipeline of the report. Then the object just
    listens as the report is running and does the work you need it to. Instead
    of using the TTable component, simply reference the Pipeline['FieldName'] =
    SomeValue technique. You should store a reference to the pipeline from the
    initial pass through call. Then you'll need a published property to assign
    the string you want to limit the records by in the skip methods.

    It is a little complicated, but it should work just fine. Let me know if you
    have any questions about this approach.

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited May 2003
    Right for the pass through function, but why can I use the Eof function
    et can't use the Next ?

    Philippe Constant
    CTRL Informatique

  • edited May 2003
    Next is a procedure and is not made visible in RAP through the RAP RTTI for
    TppDataPipeline ancestor. EOF is a property and is made available through
    the RAP RTTI for the TppDBPipeline descendent. You'll have to create a RAP
    pass through function (pass the datapipeline as a parameter of the function)
    in order to call Next on the pipeline.

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.