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

Scan a dataset

edited October 2007 in RAP
Hello DM-team!

Is there a way to loop (while not eof) through a dataset in RAP?

I need to dynamically create a lot of Labels and place them on a grid in a
single-page
report. The Labels will be placed in the grid where Label.left is calculated
from a DateTime value
in the dataset and the Label.Top is calculated from the day of a week.

Best regards,
Terje

Comments

  • edited October 2007
    Hi Terje,

    Two options...

    1. Create a pass thru function that traverses your dataset directly and
    returns the proper value to the RAP program. For an example of creating a
    pass thru function, please see the developer's guide located in the
    \RBuilder\Developer's Guilde\... directory.

    2. Extend the existing RTTI class for the TppDataPipeline and use the Next
    method to traverse a datapipeline connected to your dataset from RAP. See
    the article below on adding additional support to existing RTTI classes.

    --------------------------------------------------
    Article: Adding Support to Existing RTTI Classes
    ---------------------------------------------------

    "I notice that TppDataPipeline (or some other class)
    has a Next method (or some other member),
    but the RAP compiler doesn't seem to recognize that
    method, are you going to add support for that?"

    There are a number of class members which have not been
    added to RAP via the RTTI classes. We have tried to add
    support for the most commonly used members. (Keep in
    mind that all published properties are supported
    automatically, public methods and properties require
    a bit of coding to make visible in RAP).

    The answer to your question is that, yes, we could
    add support for a given member in the next release,
    but you can do it yourself more quickly and it is
    not very difficult.

    Using the RTTI tutorial located in the RAP help file,
    you can familiarize yourself with the process. Following
    that, you can descend your own RTTI class to add the
    support for the member you are lacking.
    Take, for instance, the TppDataPipeline that is missing the
    Next method. You will find TraTppDataPipelineRTTI in
    the ppDB unit. You can descend from TraTppDataPipelineRTTI
    in a new unit as
    TmyTppDataPipelineRTTI = class(TraTppDataPipelineRTTI).

    Add your support to the new class (see the tutorials
    for information) and then add the following in
    your Initialization/Finalization sections:

    Initialization
    raUnregisterRTTI(TraTppDataPipelineRTTI):
    raRegisterRTTI(TmyTppDataPipelineRTTI);
    Finalization
    raUnregisterRTTI(TmyTppDataPipelineRTTI);
    raRegisterRTTI(TraTppDataPipelineRTTI);

    When you add this unit to your projects, your new, improved
    RTTI class will replace the old class, thus providing
    your new support without having to alter the source
    code in any way.


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