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

Publishing Constants

edited October 2002 in End User
How can I publish constants from Delphi to to the end user?

Thanks,

Matt

Comments

  • edited October 2002
    Create RAP pass through functions to surface these to the end user. There
    are examples of creating RAP pass through functions in the RAP demos and
    tutorials directories in your RBuilder\Demos\RAP installation directory.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited October 2002
    I already know how to do pass-through functions but they don't expose the
    constants as far as I knew. I want the end user to be able to use my
    pass-through function in RAP like the following example.

    FFooterBarCode.Data := ReportBarcode(PROJECT_NUM, Project['Seqno']);

    Can you give me more specifics. I already have the ReportBarcode
    pass-through function working the way I want.

    Thanks,

    Matt
  • edited October 2002
    RAP doesn't support constants as it does classes or pulished properties of
    classes. I meant that the constant would really be a pass through function
    call to get the value from your Delphi constant. You could place these
    functions in a "Constants" node of the code toolbox to appear as if they
    were constants, since they would be used in the same way at the end user
    level.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited October 2002
    Yuk. That means I have to make a function for each of my 75 constants.
    Will this be a capability of future versions possibly?

    Thanks,

    Matt
  • edited October 2002
    RAP relies on RTTI. We'd have to extend the RAP RTTI classes to support
    constants so that you can register them. Essentially, you would be
    performing the same thing as writing pass though functions in order to
    surface them in RAP. They wouldn't automatically be surfaced in RAP because
    there is no RTTI for them and RAP doesn't know that it should surface them,
    because they aren't components in the report layout.

    As an alternative to creating pass through functions, the only possible
    option I can think of is to create a JITPipeline with one record in it.
    You'll have 75 fields which return the individual constant values. In the
    OnGetFieldValue event of the JITPipeline, you'll have a huge 75 item
    selection statement that returns each of your constants based on the field
    name.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited October 2002
    I think I understand what you are saying but still would be a lot simpler to
    just register the constants rather than have to define a function, etc for
    them.

    Thanks,

    Matt
  • edited October 2002
    Since you would have to create a TraMyConstantRTTI class, it would be just
    as much coding on your side to register them via an TraMyConstantRTTI class
    or a RAP pass through function class. The RAP pass through is probably the
    way to go on this one.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited October 2002
    Hi Jim,

    I think Matt means the enduser.

    Cheers,
    Chris Ueberall;
  • edited October 2002
    Hi Chris,

    Now I see what Matt is getting at. The end user shouldn't see that there is
    a function call being made in the code toolbox. For each of the 75
    "constants" in RAP, there is a Definition column in the grid which will say
    "function PROJECT_NUM: Integer;" when it could say "constant PROJECT_NUM"
    or just "PROJECT_NUM" in a "Constants" node of the code toolbox. Maybe in a
    future release. I placed it on the ToDo list.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.