Pass a context instance to 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
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
This discussion has been closed.
Comments
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.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com