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

Calculate variable in one subreport and use it in another

edited February 2006 in RAP
Hi,

I am struggling with the following:

Mainreport has a child subreport placed in the detail band. This subreports
calculates a value i have to use in a second subreport placed in the
summaryband of the main report.
I have used a global TppVariable in the past to show a subreport value in
the main report but I can't use this technic to share a variable between 2
subreports i think.
How should I get this working?

Using D7, RB 7.04 Ent.

Regards,
Jeroen R?ttink

Comments

  • edited February 2006
    Hi Jeroen,

    You should be able to access the global variables from the second subreport.
    The same concept applies as showing a variable value in the main report.
    You will need to assign the global variable value inside the OnCalc of the
    variable in the first subreport, then assing the global variable to a
    variable located in the second subreport.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2006
    Hi Nico,

    I can't get it to work (result stays 0.00). when using a variable in the
    mainreport.summary works ok.
    The variable in the second subreport has 'calculate on' reportend and 'reset
    on' reportend like in your example 'TotalsFromSubreportWithRAP.zip'.

    Regards,
    Jeroen R?ttink.


  • edited February 2006
    Hi Jeroen,

    Are you simply trying to display the calculated value of a variable located
    in the first subreport inside the second subreport? If so, you can simply
    place a TppVariable inside the second subreport and assign it's value to the
    already calculated global variable, perhaps in the Band.BeforePrint event.
    Something like the following...

    procedure DetailBeforePrint
    begin
    Variable1.Value := gSummaryTotal.Value

    end;

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