Home Subreports

Help subreport

edited November 2007 in Subreports
I'm currently developing a report, which possess 7 sub-reports in it. Each
sub-report has a calcfield called 'variable', that represents the sum of
some values from the sub-report...

What I'd like to know is: How can I show, for example, a 'variable' from the
sub-report 1 in the sub-report X...? Or at last, the value of 'variable' 1
in the sub-report X.

I need those values to represent the sum of all the 'variables'.

Ex:

Sub1 -> Variable1;
Sub2 -> Variable2;
Sub3 -> Variable3;
Sub4 -> Variable4;

SubX -> Variable1; Variable2; Variable3; Variable4...

Thank you
Deivid Sartori

Comments

  • edited November 2007
    You can define your TppVariables in the main report section, and use
    them via code in the subreports.

    Ex:

    Declaration (main tab)
    refSubreport1 = TppVariable;

    From any variable.OnCalc in the subreports you can access this
    variable and set its value or use its value.
    refSubreport1.value := abc;

    Hope this helps.

    Chantal

    On Mon, 26 Nov 2007 11:51:22 -0200, "Deivid Sartori"
  • edited November 2007
    Hi Deivid,

    Chantal is correct. Below is an example of how to reference a TppVariable
    in the main report from a subreport. The same concept will apply when
    trying to reference a variable in another subreport.

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

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2007
    Do not worked properly,
    Said the global var

    VarReportCalc1: TppVariable;

    And subreport1 added the suspect to variable2:

    Variable2.value: = variable1.value + value;
    VarReportCalc1: = variable2.value;

    Then in the main report added to variable3 with the calculation:

    Value: = VarReportCalc1;

    The correct value is 480.00 but returned 143658200 ..

    If I tell a value manual VarReportCalc1: = 10; it shows correctly then why
    not bring the correct value when I informed the calculated field?

    --
    Deivid Sartori
  • edited November 2007
    A TppVariable is a "pointer".

    You must set and use the "value" of the variable and not the
    variable itself. The same way you do for the Variable2 declared in the
    layout.

    So try this:

    VarReportCalc1.Value := variable2.value;

    Value := VarReportCalc1.value;

    143658200 is actually the address of the variable and not its value.



    On Mon, 26 Nov 2007 14:17:54 -0200, "Deivid Sartori"
This discussion has been closed.