Skip to main content

FunctionOperator Class

A function operator based on a FunctionOperatorType.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v23.1.dll

NuGet Package: DevExpress.Data


public class FunctionOperator :

The following members return FunctionOperator objects:


The FunctionOperator class is a function operator that can be used along with other operators when constructing complex filter criteria. To create a function operator, create an instance of the FunctionOperator class and initialize its settings via the constructor parameters. See the FunctionOperatorType topic, for a list of the available function types.

In addition to built-in functions, you can implement and use any number of custom functions. Refer to How to: Implement a Custom Criteria Language Function Operator to learn more.

It’s also possible to use the CriteriaOperator.Parse method to create a CriteriaOperator operator for a specific expression.


Refer to the Build Criteria - Cheat Sheet article for more examples.


The following example shows how to use the IIF function operator to construct filter criteria. The criteria is then used to select appropriate records from storage using an XPCollection. The criteria that are implemented are defined by the following expression: IIF(Field1 == 100, Field1, Field2) > 1000. Firstly the IIF(…) subexpression is evaluated. The result is then compared with 1000. Objects are selected by the criteria if the result of the IIF(…) function is greater than 1000 for them.

This example shows two equivalent ways to set up the filter criteria:

You can see that the second approach is easier and more human readable


The CriteriaOperator.Parse method analyzes the string passed as a parameter, and then creates an equivalent tree of CriteriaOperator operators for it.

using DevExpress.Xpo;
using DevExpress.Data.Filtering;

// Approach 1
// Define the operands for the IIF function operator.
CriteriaOperator[] operands = new CriteriaOperator[] {
   new BinaryOperator("Field1", 100),
   new OperandProperty("Field1"),
   new OperandProperty("Field2")
CriteriaOperator criteria = new BinaryOperator(
   new FunctionOperator(FunctionOperatorType.Iif, operands),
   new OperandValue(1000),
XPCollection collection = new XPCollection(typeof(MyObject), criteria);

//Approach 2
CriteriaOperator criteria1 = CriteriaOperator.Parse(
  "Iif(Field1 == 100, Field1, Field2) > 1000");
XPCollection collection1 = new XPCollection(typeof(MyObject), criteria1);

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FunctionOperator class.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.


See Also