Skip to content

TAggregateSum

Internally used class for sum aggregate functions

Declaration

Source position: fpexprpars.pp line 676

type

  TAggregateSum = class(TAggregateExpr)
  public
    function ConvertArgument : TFPExprNode;
    procedure InitAggregate;
    procedure UpdateAggregate;
  end;

Description

The TAggregateSum class implements the sum aggregate function, which calculates the total of all processed numeric values. It extends TAggregateExpr to provide summation-specific aggregation logic.

The class maintains an internal accumulator that adds each new value to the running total. It handles different numeric types (integers, floats, currency) and performs appropriate type conversions to maintain precision during the summation process.

The sum function ensures type safety by converting arguments to compatible numeric types before performing addition operations. The final result type depends on the types of values processed during aggregation.

This class is used internally by the TFPExpressionParser class to construct an AST (Abstract Syntax Tree). There is normally no need for you to use or instantiate this class directly.

Methods

Member Visibility Description
ConvertArgument public Convert argument for sum aggregation
InitAggregate public Initialize sum aggregation
UpdateAggregate public Update sum aggregate with new value
See all Methods

See also

Name Description
TFPExprNode Class for representing nodes in expression trees