Class TotalGroupSumFunction

  • All Implemented Interfaces:
    Serializable, Cloneable, EventListener, ReportListener, AggregationFunction, Expression, FieldAggregationFunction, Function
    Direct Known Subclasses:
    TotalPageSumFunction

    public class TotalGroupSumFunction
    extends AbstractFunction
    implements FieldAggregationFunction
    A report function that calculates the sum of one field (column) from the Data-Row. This function produces a global total. The total sum of the group is known when the group processing starts and the report is not performing a prepare-run. The sum is calculated in the prepare run and recalled in the printing run.

    The function can be used in two ways:

    • to calculate a sum for the entire report;
    • to calculate a sum within a particular group;
    This function expects its input values to be either java.lang.Number instances or Strings that can be parsed to java.lang.Number instances using a java.text.DecimalFormat.

    The function understands two parameters, the field parameter is required and denotes the name of an ItemBand-field which gets summed up.

    The parameter group denotes the name of a group. When this group is started, the counter gets reset to null. This parameter is optional.

    Author:
    Thomas Morgner
    See Also:
    Serialized Form
    • Field Detail

      • ZERO

        protected static final BigDecimal ZERO
        A useful constant representing zero.
      • currentGroupKey

        protected transient ReportStateKey currentGroupKey
        The current group key is used to store the result for the current group.
    • Constructor Detail

      • TotalGroupSumFunction

        public TotalGroupSumFunction()
        Constructs a new function.

        Initially the function has no name...be sure to assign one before using the function.