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

How to set the values of Global variables from Delphi code.

edited June 2006 in RAP
Im using Delphi 6 RB 7.

I have a couple of Global Variable in my report and its value need to be
changed before the Report is printed. How can I do this ?

Gloabl Variables in ppReport1 :

var
AAA: String;


In my delphi code I need to do this

ppReport1.AAA := ' This is a Test ';
ppReport1.Print;


Thanks in advance

Thatchi
~~~~~~~~~~

Comments

  • edited June 2006
    Hi Thatchi,

    You will need to use the Report Parameters feature to assign your global
    variables in RAP a value. Take a look a the following example of how to use
    parameters to assign values in RAP.

    http://www.digital-metaphors.com/tips/SimpleParameters.zip

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2006
    Hi Nico !
    Thanks, but does RB 7.0 support parameters ? I thought it did not, thats why
    I wanted to use Global variables. Any way I got that running by using one of
    the sample code what u gave in one of the earlier posts.

    lGlobalCreateProgram.SourceLines.Clear;
    lGlobalCreateProgram.SourceLines.Add('procedure GlobalOnCreate; ');
    lGlobalCreateProgram.SourceLines.Add('begin' + #13#10);

    etc. This works fine, but for some reason I had to use these two units to
    get it running.

    raTypes, raClass

    Why is that ?

    Another question, will report be slowed down when RAP and Global var are
    used ?


    Thanks .

    Thatchi
    ~~~~~~~~~~

  • edited June 2006
    Hi Thatchi,



    Yes, sorry, I missed that you were using RB 7.



    The raTypes and raClass files are probably needed for some of the objects
    and types you are using in your code.



    --------------------------------------------------

    Article: RAP Performance

    ---------------------------------------------------



    Question: Do you incur any performance penalty by using the RAP interpreter?



    Answer: The penalties are negligible. This is due to the fact that RAP is
    what we call a hybrid interpreter. While it is, in fact, an interpreter, it
    is actually working as a pass-through to compiled code. Thus, when the
    interpreter encounters an Object Pascal command in the RAP code, it passes
    it through to the compiled code which handles this command. The result is
    that your reports using RAP will execute with comparable performance to
    those that have event handlers coded in Delphi.


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

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