The requested page is not available for the requested platform. You are viewing the content for Default platform.

CustomFunctions.Register(ICustomFunctionOperator[]) Method

Registers the specified custom functions in the Expression Editor in the End-User Report Designer.

Namespace: DevExpress.XtraReports.Expressions

Assembly: DevExpress.XtraReports.v19.1.dll

Declaration

public static void Register(
    params ICustomFunctionOperator[] functionOperators
)
Public Shared Sub Register(
    ParamArray functionOperators As ICustomFunctionOperator()
)

Parameters

Name Type Description
functionOperators ICustomFunctionOperator[]

A collection of ICustomFunctionOperator objects specifying custom functions to register.

Remarks

The Register method registers a custom function in the Expression Editor to use for specifying control expression bindings and calculated fields expressions along with built-in functions.

You can declare a custom function by implementing an ICustomFunctionOperator interface that provides the base functionality. Implement an ICustomFunctionOperatorBrowsable interface if you want to specify additional function information such as a category, description or parameter count.

The following example demonstrates how to create a simple custom function and register it in the End-User Designer by calling the static Register method.

using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Expressions;
// ...

public class MyCustonFunction : ICustomFunctionOperator {

    object ICustomFunctionOperator.Evaluate(params object[] operands) {
        // Insert your custom logic here.
        // For demonstration purposes, multiply an operand value to 10.
        return (Convert.ToDouble(operands[0]) * 10);
    }

    string ICustomFunctionOperator.Name {
        get { return "MyFunction"; }
    }

    Type ICustomFunctionOperator.ResultType(params Type[] operands) {
        return typeof(double);
    }
}

public Form1() {
    // ...
    CustomFunctions.Register(new MyCustonFunction());        
    reportDesigner1.OpenReport(new XtraReport());            
}
See Also