net.sf.jasperreports.engine

## Interface JRSubreportReturnValue

- All Superinterfaces:
    java.lang.Cloneable, JRCloneable
  All Known Implementing Classes:
    JRBaseSubreportReturnValue, JRDesignSubreportReturnValue, JRFillSubreportReturnValue, SubreportReturnValueAdapter

      public interface JRSubreportReturnValue
      extends JRCloneable

  A value copied from a subreport into a variable of the master report.

  The `subreportVariable` attribute (see `getSubreportVariable()`) specifies the name of the subreport variable whose value is to be returned. At fill time, the name is checked to ensure it is an existing variable name of the report specified by the subreport expression.

  The `toVariable` attribute (see `getToVariable()`) specifies the name of the parent report variable whose value is to be copied/incremented with the value from the subreport. The name is checked at compile time to ensure it is an existing variable name of the master report. At fill time, the system checks that the types of the subreport and master variables are compatible.

  A value returned from a subreport can simply be copied into the target master report variable, or it can be subject to a certain type of calculation made on the variable. The type of the operation performed with the returned value is specified by the calculation attribute (see `getCalculationValue()`), which works like the homonym attribute of the `<variable>` element. The default value is `Nothing`, which means that the value returned from the subreport will be simply copied into the master report variable.

  Just as for report variables, the engine lets users customize how they want the returned subreport values handled. The `incrementerFactoryClass` attribute (see `getIncrementerFactoryClassName()`) specifies the factory class for creating the incrementer instance. The attribute is equivalent to the same attribute of the `<variable>` element.

  A variable of the master report used when returning values from subreports should be declared with `System` calculation because its value is not calculated by the main calculation engine. The variable could declare a reset type, for example, when the sum of a subreport total is to be calculated per one of the master's groups. The same value can be returned more than once from a subreport, for example, if different calculations are required.

  Note that the value from the subreport is not returned on a column or page break, but only when the subreport filling is done. Also note that the calculation is a two-level process - that is, if the subreport computes a total average and the master accumulates values from the subreports using calculated averages, then the master result will be the average of the subreport averages, not the average of the combined subreport records.
  Version:
    $Id: JRSubreportReturnValue.java 7051 2014-04-25 13:46:34Z shertage $
  Author:
    Lucian Chirita (lucianc@users.sourceforge.net)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `CalculationEnum` | `getCalculationValue()` Returns the calculation type.
    `java.lang.String` | `getIncrementerFactoryClassName()` Returns the incrementer factory class name.
    `java.lang.String` | `getSubreportVariable()` Returns the name of the subreport variable whose value should be copied.
    `java.lang.String` | `getToVariable()` Returns the name of the master report variable where the value should be copied.

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRCloneable

      `clone`

- - ### Method Detail

    - #### getSubreportVariable

          java.lang.String getSubreportVariable()

      Returns the name of the subreport variable whose value should be copied.
      Returns:
        the name of the subreport variable whose value should be copied.

    - #### getToVariable

          java.lang.String getToVariable()

      Returns the name of the master report variable where the value should be copied.
      Returns:
        the name of the master report variable where the value should be copied.

    - #### getCalculationValue

          CalculationEnum getCalculationValue()

      Returns the calculation type.

      When copying the value from the subreport, a formula can be applied such that sum, maximum, average and so on can be computed.

      Returns:
        the calculation type.

    - #### getIncrementerFactoryClassName

          java.lang.String getIncrementerFactoryClassName()

      Returns the incrementer factory class name.

      The factory will be used to increment the value of the master report variable with the value from the subreport.

      Returns:
        the incrementer factory class name.

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com