Used to specify the usage and the design time description of the
aggregate function. This class cannot be inherited.
Namespace: Telerik.Reporting.ExpressionsAssembly: Telerik.Reporting (in Telerik.Reporting.dll)
Syntax
| C# |
|---|
public sealed class AggregateFunctionAttribute : Attribute |
| Visual Basic |
|---|
Public NotInheritable Class AggregateFunctionAttribute _
Inherits Attribute |
Examples
This example shows the usage of the attribute.
CopyC#
[AggregateFunction(Description = "Concatenation aggregate. Output: (value1, value2, ...)", Name = "Concatenate")]
class ConcatenateAggregate : IAggregateFunction
{
string result;
public void Accumulate(object[] values)
{
object value = values[0];
if (null == value)
{
return;
}
if (this.result.Length > 0)
{
result += ", ";
}
this.result += value.ToString();
}
public object GetValue()
{
return string.Format("({0})", this.result);
}
public void Init()
{
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;
}
}
}
CopyVB.NET
<AggregateFunction(Description:="Concatenation aggregate. Output: (value1, value2, ...)", Name:="Concatenate")> _
Class ConcatenateAggregate
Implements IAggregateFunction
Private result As String
Public Sub Accumulate(ByVal values As Object()) Implements IAggregateFunction.Accumulate
Dim value As Object = values(0)
If value Is Nothing Then
Return
End If
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
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
Inheritance Hierarchy
Version Information
Supported in: 1.0.1
See Also