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

Custom enumerated types?

edited April 2004 in RAP
Is it possible to add custom enumerated types in the same fashion that we
can add custom functions to RAP? My databases have a bunch of fields that
use integer constants like 0,1,2 instead of 'Inbox', 'Drafts', 'Sent Items'
for example... I'd like to create some types like
TmyMailBoxType = (mmtInBox = 0, mmtDrafts = 1, mmtSentItems = 2)
and have these available in the RAP calc workspace.

About the only other way I could think of doing this is to provide a bunch
of functions that return an integer value - one for each constant - and
register/unregister all these functions... but that would be a real pain
because I have about 300 constants that I'd like to surface, so it's not
really an option I'm considering.

Best Regards,

James Crosswell
Software Engineer
Microforge.net Limited
http://www.microforge.net

Comments

  • edited April 2004

    Yes you can register enum types with ReportBuilder. The
    RBuilder\Source\ppEnum.pas contains the registration routines and registers
    the default enum types used within ReportBuilder.


    Here is an example of what you need to code:


    uses
    ppEnum;

    initialization
    raRegisterEnum('TppUnitType', TypeInfo(TppUnitType));
    raRegisterEnum('TppVarType', TypeInfo(TppVarType));

    finalization
    raUnRegisterEnum('TppUnitType');
    raUnRegisterEnum('TppVarType');



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


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2004
    "Nard Moseley (Digital Metaphors)" wrote in
  • edited April 2004

    Once you register the enums, they will show up in the Code Toolbox on the
    Language tab under the Enuimerated Types node.

    Thanks for the feedback - that information needs to be added.

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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.