skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop
    Web
    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for ASP.NET AJAX UI for ASP.NET MVC UI for ASP.NET Core UI for Blazor UI for Silverlight UI for PHP UI for JSP
    Mobile
    UI for .NET MAUI UI for Xamarin
    Document Management
    Telerik Document Processing
    Desktop
    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF UI for UWP
    Reporting & Mocking
    Telerik Reporting Telerik Report Server Telerik JustMock
    Automated Testing
    Test Studio Test Studio Dev Edition
    CMS
    Sitefinity
    UI/UX Tools
    ThemeBuilder
    Debugging
    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Jam FiddlerCap FiddlerCore
    Extended Reality
    UI for Unity XR
    Free Tools
    JustAssembly JustDecompile VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Docs & Support
  • Pricing
  • Search
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class AggregateFunctionAttribute

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

Inheritance
System.Object
System.Attribute
AggregateFunctionAttribute
Inherited Members
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Module)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Module, System.Type)
System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.Match(System.Object)
System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfoCount(System.UInt32)
System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfo(System.UInt32, System.UInt32, System.IntPtr)
System.Attribute.System.Runtime.InteropServices._Attribute.GetIDsOfNames(System.Guid, System.IntPtr, System.UInt32, System.UInt32, System.IntPtr)
System.Attribute.System.Runtime.InteropServices._Attribute.Invoke(System.UInt32, System.Guid, System.UInt32, System.Int16, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr)
System.Attribute.TypeId
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.Reporting.Expressions
Assembly: Telerik.Reporting.dll

Syntax

[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class AggregateFunctionAttribute : Attribute, _Attribute
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;
        }
    }
}
 _
Class ConcatenateAggregate
    Implements IAggregateFunction
    Private result As String

    Public Sub Accumulate(ByVal values As Object()) Implements IAggregateFunction.Accumulate
        ' The aggregate function expects one parameter
        Dim value As Object = values(0)

        ' null values are not aggregated
        If value Is Nothing Then
            Return
        End If

        ' The actual accumulation
        If Me.result.Length > 0 Then
            result += ", "
        End If
        Me.result += value.ToString()
    End Sub

    Public Function GetValue() As Object Implements IAggregateFunction.GetValue
        Return String.Format("({0})", Me.result)
    End Function

    Public Sub Init() Implements IAggregateFunction.Init
        ' Add aggregate function initialization code here if needed
        Me.result = String.Empty
    End Sub

    Public Sub Merge(ByVal aggregateFunction As IAggregateFunction) Implements IAggregateFunction.Merge
        Dim aggregate As ConcatenateAggregate = DirectCast(aggregateFunction, ConcatenateAggregate)

        If aggregate.result.Length > 0 Then
            If Me.result.Length > 0 Then
                result += ", "
            End If
            Me.result += aggregate.result
        End If
    End Sub
End Class

Constructors

AggregateFunctionAttribute()

Initializes a new instance of the AggregateFunctionAttribute class.

Declaration
public AggregateFunctionAttribute()

Fields

Default

Returns the default instance of the attribute with all its properties set to default values.

Declaration
public static readonly AggregateFunctionAttribute Default
Field Value
AggregateFunctionAttribute

Properties

Description

Gets the description of the aggregate function displayed in the expression builder.

Declaration
public string Description { get; set; }
Property Value
System.String

IsVisible

Gets a value indicating whether the aggregate should be shown at design time. Default value is true.

Declaration
public bool IsVisible { get; set; }
Property Value
System.Boolean

Name

Gets the name of the aggregate function as it should be used in the expressions.

Declaration
public string Name { get; set; }
Property Value
System.String

ReturnType

Gets or sets the return type of the aggregate function as it should be used in the expressions.

Declaration
public Type ReturnType { get; set; }
Property Value
System.Type

Methods

Equals(Object)

Indicates whether this attribute instance and a specified object are equal.

Declaration
public override bool Equals(object obj)
Parameters
System.Object obj

Another object to compare to.

Returns
System.Boolean

true if obj is equal to this instance; otherwise, false.

Overrides
System.Attribute.Equals(System.Object)

GetHashCode()

Returns the hash code for this attribute instance.

Declaration
public override int GetHashCode()
Returns
System.Int32

A 32-bit signed integer hash code.

Overrides
System.Attribute.GetHashCode()

IsDefaultAttribute()

Determines if this attribute is the default.

Declaration
public override bool IsDefaultAttribute()
Returns
System.Boolean

true if the attribute is the default value for this attribute class; otherwise, false.

Overrides
System.Attribute.IsDefaultAttribute()

Was this article helpful?

Tell us how we can improve this article

Skip
Getting Started
  • Install Now
  • Online Demos
Support Resources
  • Documentation
  • Knowledge Base
  • Videos
  • Reporting Samples Repository
  • Reporting Release History
Community
  • Forums
  • Blogs
  • Reporting Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.