Hi!
I wonder if it is possible in Delphi source to get hold of the global
variables declared in the rtm file. The reason I ask this is I need to pass
certain information (not DB related) from Delphi into the Report Builder
during printing. Thanks
Thomas Liaw
Comments
RAP newsgroup. Search for the threads dated 3/16/2002 and 3/17/2002 which
show how to create a global variable and how to initialize them by creating
a global OnCreate event handler in RAP.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
user group for the question. I have found the threads you mentioned. The
thread contains code how to create a global variable but not saying anything
about how to initialize it. Actually, I am not so much of wanting to create
a global variable. Instead, I just want to assign a value into the global
variable declared in the rtm file in my Delphi code, before I can do that, I
guess I need to retrieve such global variable (and probably need to cast it
to the appropriate data type). Any help will be appreciated.
Thomas Liaw
applications. The first application is able to compile the other. Let's
say that you have a class in a pas file of the to-be-compiled application,
but you need to change one of the class' private varaibles which is
initialized in the class' constructor. The catch is that you need to do
this from the other application, since the other application calculates the
value that is to be set. The way to do this is to open the pas file and
change the initialized value string, before the pas file is compiled.
The same approach should be taken if you use RAP this way. The RAP programs
are simply text lines which get compiled (interpreted). This text is what
needs to be changed so that the new value will be included every time RAP
compiles the global OnCreate event handler "program." You'll only need to
set the text once, and it will be persistent as you run the report multiple
times. In the example code you've found, you'll see that the program is
extracted and then the lines are cleared. Instead of clearing the lines,
you just need to parse through these lines and find the variable that you
want to change. Once you've found the line which sets the variable value,
simply set that line of code to a new string which sets it to the new value.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com