Interface JRSubreportReturnValue

  • All Superinterfaces:
    java.lang.Cloneable, CommonReturnValue, JRCloneable, VariableReturnValue
    All Known Implementing Classes:
    JRBaseSubreportReturnValue, JRDesignSubreportReturnValue, SubreportReturnValueAdapter, SubreportReturnValueAdapter

    public interface JRSubreportReturnValue
    extends VariableReturnValue
    A value copied from a subreport into a variable of the master report.

    The subreportVariable attribute (see VariableReturnValue.getFromVariable()) 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 CommonReturnValue.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 CommonReturnValue.getCalculation()), 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 CommonReturnValue.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.

    Author:
    Lucian Chirita (lucianc@users.sourceforge.net)