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

Global variable

edited April 2007 in General
Hello,

Can y send to my report a global variable ?
I would like to have a variable (defined in Delphi) in a box that i can drop
on my page like a data.

Is it possible ?

I saw the parameters editor box and i defined one, but i can use in
reportBuilder, i can't access it.

David.

Comments

  • edited April 2007
    Hi David,

    Parameters can be accessed in RAP and assigned to a global variable if
    needed. ReportBuilder does not have a built-in feature to access parameters
    from the designer however it is very simple from RAP. The following example
    shows how they can be used.

    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 April 2007
    Hello Nico,

    I can't load the entire program: "Class TraCodeModule not found..."

    I saw the "SystemInfo" in ppReport1's parameters, but nothing in report (on
    the page, i've only "label1" that render: Label1 on preview).
    How can i get this parameter in report ?

    Can't i have a parameter named "myParameter" ?

    Regards.

  • edited April 2007
    d.morel@gentag.fr wrote

    If you are talking about doing this in Delphi, here is a snippet of code
    from how I did this. This works even without RAP ability.

    The user selects a report in a list box, then chooses a date range (Min &
    Max Date). Based upon those selections, a variable component calculates the
    labels to display on the report, such as:
    Min. Date: 1/1/06
    Max. Date: 12/31/06

    =====================
    {wMinDate & wMaxDate are global variables set based upon user selection from
    a date component}

    procedure TLoanReportForm.ppMinDateCalc(Sender: TObject;
    var Value: Variant);
    begin
    Value:='Min. Date:'+FormatDateTime('m/d/yy',wMinDate);
    end;

    procedure TLoanReportForm.ppMaxDateCalc(Sender: TObject;
    var Value: Variant);
    begin
    Value:='Max. Date:'+FormatDateTime('m/d/yy',wMaxDate);
    end;
  • edited April 2007
    Hi David,

    If you would like to access parameters from within the report template, you
    will need to use RAP which is available with the Enterprise edition of
    ReportBuilder. Otherwise you will need to create your "global variable"
    values in Delphi and assign them to the report using one of the report
    events such as the OnCalc as David Miller mentioned in his post.


    --
    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.