Progress® Telerik® Reporting R3 2017

AggregateFunctionAttribute Class

Used to specify the usage and the design time description of the aggregate function. This class cannot be inherited.

Inheritance Hierarchy

SystemObject
  SystemAttribute
    Telerik.Reporting.ExpressionsAggregateFunctionAttribute

Namespace:  Telerik.Reporting.Expressions
Assembly:  Telerik.Reporting (in Telerik.Reporting.dll)

Syntax

public sealed class AggregateFunctionAttribute : Attribute

The AggregateFunctionAttribute type exposes the following members.

Constructors

  NameDescription
Public methodAggregateFunctionAttribute
Initializes a new instance of the AggregateFunctionAttribute class.
Top

Properties

  NameDescription
Public propertyDescription
Gets the description of the aggregate function displayed in the expression builder.
Public propertyIsVisible
Gets a value indicating whether the aggregate should be shown at design time. Default value is true.
Public propertyName
Gets the name of the aggregate function as it should be used in the expressions.
Public propertyReturnType
Gets or sets the return type of the aggregate function as it should be used in the expressions.
Top

Methods

Fields

  NameDescription
Public fieldStatic memberDefault
Returns the default instance of the attribute with all its properties set to default values.
Top

Examples

This example shows the usage of the attribute.
[AggregateFunction(Description = "Concatenation aggregate. Output: (value1, value2, ...)", Name = "Concatenate")]
class ConcatenateAggregate : IAggregateFunction
{
    string result;

    public void Accumulate(object[] values)
    {
        // The aggregate function expects one parameter
        object value = values[0];

        // null values are not aggregated
        if (null == value)
        {
            return;
        }

        // The actual accumulation
        if (this.result.Length > 0)
        {
            result += ", ";
        }
        this.result += value.ToString();
    }

    public object GetValue()
    {
        return string.Format("({0})", this.result);
    }

    public void Init()
    {
        // Add aggregate function initialization code here if needed
        this.result = string.Empty;
    }

    public void Merge(IAggregateFunction aggregateFunction)
    {
        ConcatenateAggregate aggregate = (ConcatenateAggregate)aggregateFunction;

        if (aggregate.result.Length > 0)
        {
            if (this.result.Length > 0)
            {
                result += ", ";
            }
            this.result += aggregate.result;
        }
    }
}

See Also