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

Varible Calculations In Subreport

edited October 2006 in General
I do I perform a variable calculation in a main report using the value of a
variable in a subreport?
I have tried the following but get errors:

Variable1.AsDouble :=SubReport1['vSub'].AsDouble;
Variable1.AsDouble :=SubReport1.vSub.AsDouble;

I have also tried it in the subreport by referencing the main report using
the following but get errors:
Report.Variable1.AsDouble :=vSub.AsDouble;

I know I am missing something but just can't get it to work.

Thanks,
Bob

Comments

  • edited October 2006
    Hi Bob,

    Are you making these calls from RAP or Delphi code?

    If this is from Delphi, you are given direct access to each variable when
    you place them inside a report. For instance from the OnCalc of the
    variable inside the subreport, (vSub) you might say...

    Variable1.Value := Variable1.Value + Value;

    If you are coding in RAP, you will need to create a global variable and set
    it equal to the variable in the main report to gain access to it from the
    OnCalc event of the subreport variable. Take a look at the following
    example on how this can be done.

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

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2006
    I am using RAP. I will look at the sample and try to determine how to setup
    a global variable and resolve the issue.

    Thanks,
    Bob

This discussion has been closed.