Skip to main content
All docs
V24.1

ReportCustomFunctionOperatorBase Class

A base class for custom functions in the Expression Editor.

Namespace: DevExpress.XtraReports.Expressions

Assembly: DevExpress.XtraReports.v24.1.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public abstract class ReportCustomFunctionOperatorBase :
    IReportCustomFunctionOperator,
    ICustomFunctionOperatorBrowsable,
    ICustomFunctionOperator,
    ICustomFunctionCategory

Remarks

To create a custom function, create an object that descends from the ReportCustomFunctionOperatorBase abstract class.

The following code defines a custom function (NewLineConstant) that inserts a new line symbol:

using DevExpress.XtraReports.Expressions;
using System;
namespace CustomFunctionForExpressionEditorExample
{
    public class NewLineConstant : ReportCustomFunctionOperatorBase
    {
        public override string FunctionCategory 
            => "String";
        public override string Description 
            => "NewLineConstant()\r\nInserts a new line.";
        public override bool IsValidOperandCount(int count) 
            => count == 0;
        public override bool IsValidOperandType(int operandIndex, int operandCount, Type type)
            => true;
        public override int MaxOperandCount => 0;
        public override int MinOperandCount
            => -1;
        public override object Evaluate(params object[] operands)
        {
            return Environment.NewLine;
        }
        public override string Name
            => "NewLineConstant";
        public override Type ResultType(params Type[] operands)
        {
            return typeof(string);
        }
    }
}

Call the static CustomFunctions.Register method at application startup to register a custom function.

Inheritance

Object
ReportCustomFunctionOperatorBase
See Also