Home RAP

Pass a context instance to RAP

edited September 2012 in RAP
Hello,

I need to pass an instance of a context class (containing database connection and more) to a report before it will be rendered. In some Functions (descendants of TraSystemFunction) I need to access this instance. How can I do this? A global variable doesn't work because I need this to be threadsafe.

Can I access the MainReport in a TraSystemFunction or a TraTComponentRTTI without passing it explicit?

Regards,
Michael

Comments

  • edited September 2012
    Hi Michael,

    The best way to pass information to RAP is by using Report parameters.
    In your case you could tie the instance of your custom object to the Tag
    property of a parameter, then in RAP, using a pass-thru function
    (TraSystemFunction) you could pass this report parameter to access the
    information you need.

    I created a simple example using a TStringList that proves the concept.
    If you would like to see it let me know.


    No, you will need to pass the report object to the TraSystemFunction in
    order to access it.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.