Skip to main content
A newer version of this page is available. .

FunctionOperatorType Enum

Enumerates function types that can be used by the FunctionOperator operators.

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v18.2.dll

Declaration

public enum FunctionOperatorType

Members

Name Description
None

The function type is not specified.

Custom

Identifies a custom operation. This operation is executed on the client side if its operands represent constants. A custom operation is executed on the server side only if its operands cannot be evaluated locally. To learn how to implement custom operators, refer to the How to: Implement a Custom Criteria Language Function Operator topic.

The eXpress Persistent Objects framework provides two custom function operators - IsExactTypeFunction and IsInstanceOfTypeFunction.

CustomNonDeterministic

Identifies a custom nondeterministic operation.

Unlike a standard custom operation, a custom nondeterministic operation is always executed on the server side, regardless of whether its operands are constants.

Refer to the How to: Implement a Custom Criteria Language Function Operator topic, to learn how to implement custom operators.

Iif

Returns one of several specified values depending upon the values of logical expressions. The function can take 2N+1 arguments (N - the number of specified logical expressions):

  • Each odd argument specifies a logical expression;
  • Each even argument specifies the value that is returned if the previous expression evaluates to true.

Examples:
Iif(Name = ‘Bob’, 1, 0)
Iif(Name = ‘Bob’, 1, Name = ‘Dan’, 2, Name = ‘Sam’, 3, 0)

IsNull

Compares the first operand with the NULL value.

This function requires one or two operands of the CriteriaOperator class. The value returned depends upon the number of arguments.

If a single operand is passed, the function returns true if the operand is null, otherwise, false is returned.

If two operands are passed, the function returns the second operand if the first operand is null, otherwise, the first operand is returned.

To create the IsNull operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“IsNull(Field1)”) or CriteriaOperator.Parse(“IsNull(Field1AndTrueResult, FalseResult)”).

IsNullOrEmpty

Indicates whether a specified operand is a null reference or an empty string.

The function returns true if a specified operand is null or an empty string, otherwise, false is returned.

To create the IsNullOrEmpty operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“IsNullOrEmpty(Field1)”).

Trim

Returns a string containing a copy of a specified string with no leading nor trailing spaces. This function requires a single operand of the CriteriaOperator class that refers to the original string.

To create the Trim operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Trim(Field2)”);

Len

Returns the length of the string specified by an operand.

The operand should be an object of the CriteriaOperator type.

To create the Len operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Len(Field1)”);

Substring

Returns a substring extracted from the specified string. This function requires two or three operands of the CriteriaOperator class.

If two operands are passed the substring will be extracted from the beginning of the original string. The operands should be defined as follows:

1 - an original string;

2 - an integer that specifies the zero-based index at which the substring to return begins.

If three operands are passed a substring can be subtracted starting from any position in the original string. The operands should be defined as follows:

1 - an original string;

2 - an integer that specifies the zero-based index at which the substring to return begins;

3 - an integer that specifies the length of the substring.

To create a Substring operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Substring(Field1, 1, 3)”);

Upper

Converts all characters in a string operand to uppercase.

The operand should be an object of the CriteriaOperator type.

To create the Upper operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Upper(Field1)”);

Lower

Converts all characters in a string operand to lowercase.

The operand should be an object of the CriteriaOperator type.

To create the Lower operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Lower(Field1)”);

Concat

Concatenates one or more strings.

Ascii

Returns the ASCII code of the first character in a specified string operand.

If a specified operand represents an empty string, null is returned.

To create the Ascii operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Ascii(Field1)”).

Char

Converts a specified numeric operand to a Unicode character.

If a specified operand cannot be converted to a decimal or integer number, the System.NotSupportedException is thrown.

To create the Char operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Char(Field1)”).

ToStr

Returns a string representation of a specified numeric operand.

If a specified operand is not numeric, the System.NotSupportedException is thrown.

To create the ToStr operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“ToStr(Field1)”).

Note that the resulting string may vary, based on the format settings of the database system used as the backend.

Replace

Replaces all occurrences of a certain string in a specified string, with another.

The operands should be defined as follows:

1 - a string in which replacements are to be performed;

2 - a string to be replaced;

3 - a string to replace all occurrences found.

To create the Replace operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Replace(Field1, Field2, Field3)”).

Reverse

Reverses the order of characters within a specified string.

To create the Reverse operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Reverse(Field1)”).

Insert

Inserts a specified string at a certain position within another.

The operands should be defined as follows:

1 - a string in which the insertion is to be performed;

2 - an integer that specifies the zero-based index position of the insertion;

3 - a string to insert.

To create the Insert operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Insert(Field1, Field2, Field3)”).

CharIndex

Returns the index of the first occurrence of a specified substring in a specified string.

The operands should be defined as follows:

1 - a substring to search for;

2 - a string to be searched in;

3 - (optional) an integer that specifies the zero-based index at which the search starts. If this operand is not specified, the search begins from the start of the string;

4 - (optional) an integer that specifies the number of characters to examine, starting from the specified position. If this operand is not specified, the search continues until the end of the string.

This function performs a word (case-sensitive and culture-sensitive) search using the current culture. If a specified substring is found, the function returns its index. Otherwise, -1 is returned.

To create the CharIndex operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“CharIndex(Field1, Field2)”), CriteriaOperator.Parse(“CharIndex(Field1, Field2, Field3)”), or CriteriaOperator.Parse(“CharIndex(Field1, Field2, Field3, Field4)”).

Remove

Removes all, or a certain number of characters from a specified string, starting at a specified position.

The operands should be defined as follows:

1 - a string to be shrunk;

2 - an integer that specifies the zero-based index at which character removal starts;

3 - (optional) an integer that specifies the number of characters to remove, starting at the specified position. If this operand is not specified, all characters between the starting position and the end of the string are removed.

To create the Remove operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Remove(Field1, Field2)”) or CriteriaOperator.Parse(“Remove(Field1, Field2, Field3)”).

Abs

Returns the absolute value of a specified numeric operand.

If a specified operand is not numeric, the System.NotSupportedException is thrown.

To create the Abs operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Abs(Field1)”).

Sqr

Returns the square root of a specified numeric operand.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

To create the Sqr operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Sqr(Field1)”).

Cos

Returns the cosine of a specified numeric operand representing an angle, measured in radians.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

To create the Cos operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Cos(Field1)”).

Sin

Returns the sine of a specified numeric operand representing an angle, measured in radians.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

To create the Sin operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Sin(Field1)”).

Atn

Returns the angle (in radians) whose tangent is a specified numeric operand.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

To create the Atn operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Atn(Field1)”).

Exp

Returns the number e raised to the power specified by a numeric operand.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

Exp reverses FunctionOperatorType.Log. Use the FunctionOperatorType.Power operand to calculate powers of other bases.

To create the Exp operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Exp(Field1)”).

Log

Returns the logarithm of a specified numeric operand. The return value depends upon the number of operands.

If one operand is passed, the natural (base e) logarithm of a specified operand is returned.

If two operands are passed, the logarithm of a specified operand in a specified base is returned. The operands should be defined as follows:

1 - a number whose logarithm is to be calculated;

2 - the base of the logarithm.

If specified operands cannot be converted to Double, the System.NotSupportedException is thrown.

Log reverses FunctionOperatorType.Exp. To calculate the base 10 logarithm, use FunctionOperatorType.Log10.

To create the Log operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Log(Field1)”) or CriteriaOperator.Parse(“Log(Field1, Field2)”).

Rnd

Returns a random number greater than or equal to 0.0, and less than 1.0.

To create the Rnd operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Rnd()”).

Tan

Returns the tangent of a specified numeric operand representing an angle, measured in radians.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

To create the Tan operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Tan(Field1)”).

Power

Returns a specified numeric operand raised to a specific power.

The Power operator requires two operands:

1 - a number to be raised to a power;

2 - a power.

If specified operands cannot be converted to Double, the System.NotSupportedException is thrown.

Power reverses FunctionOperatorType.Log or FunctionOperatorType.Log10. Use the FunctionOperatorType.Exp operand to calculate powers of the number e.

To create the Power operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Power(Field1, Field2)”).

Sign

Returns a value indicating the sign of a number represented by a specified operand. The function returns one of the following values:

1, for positive numbers;

-1, for negative numbers;

0, if the number is equal to zero.

If a specified operand is not numeric, System.NotSupportedException is thrown.

To create the Sign operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Sign(Field1)”).

Round

Rounds a specified numeric operand to the nearest integer or to a specified number of decimal places. The rounding provided by this operator is called rounding to nearest or banker’s rounding.

The operands should be defined as follows:

1 - a value to round;

2 - (optional) a value specifying the number of decimal places to round to. 0 indicates that the first operand is rounded to the nearest integer.

To create the Round operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Round(Field1)”) or CriteriaOperator.Parse(“Round(Field1, Field2)”).

Ceiling

Returns the smallest integer greater than or equal to a specified numeric operand. The rounding provided by this operator is called rounding toward positive infinity.

If a specified operand is not numeric, the System.NotSupportedException is thrown.

To create the Ceiling operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Ceiling(Field1)”).

Floor

Returns the largest integer less than or equal to a specified numeric operand. The rounding provided by this operator is called rounding toward negative infinity.

If a specified operand is not numeric, the System.NotSupportedException is thrown.

To create the Floor operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Floor(Field1)”).

Max

Returns the larger of two numeric values.

The operands should be defined as follows:

1 - a numeric value A;

2 - a numeric value B;

To create the Max operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Max(ValueA, ValueB)”).

Min

Returns the smaller of two numeric values.

The operands should be defined as follows:

1 - a numeric value A;

2 - a numeric value B;

To create the Min operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Min(ValueA, ValueB)”).

Acos

Returns the angle (in radians) whose cosine is a specified numeric operand.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

To create the Acos operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Acos(Field1)”).

Asin

Returns the angle (in radians) whose sine is a specified numeric operand.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

To create the Asin operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Asin(Field1)”).

Atn2

Returns the angle (in radians) whose tangent is the quotient of two specified numeric operands.

The operator requires two operands representing the Cartesian coordinates (x, y) of a point:

1 - the y coordinate;

2 - the x coordinate.

If specified operands cannot be converted to Double, the System.NotSupportedException is thrown.

To create the Atn2 operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Atn2(y, x)”).

BigMul

Calculates the product of two specified numeric operands.

The operator requires two operands representing the integer values to be multiplied.

If the specified operands do not represent integer values, the System.NotSupportedException is thrown.

To create the BigMul operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“BigMul(Field1, Field2)”).

Cosh

Returns the hyperbolic cosine of a specified numeric operand representing an angle, measured in radians.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

To create the Cosh operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Cosh(Field1)”).

Log10

Returns the base 10 logarithm of a specified numeric operand.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

Log10 reverses FunctionOperatorType.Power. Use the FunctionOperatorType.Log operand to calculate the logarithm of other bases.

To create the Log10 operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Log10(Field1)”).

Sinh

Returns the hyperbolic sine of a specified numeric operand representing an angle, measured in radians.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

To create the Sinh operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Sinh(Field1)”).

Tanh

Returns the hyperbolic tangent of a specified numeric operand representing an angle, measured in radians.

If a specified operand cannot be converted to Double, the System.NotSupportedException is thrown.

To create the Tanh operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Tanh(Field1)”).

PadLeft

Pads a string with spaces or a specified Unicode character on the left for a specified total length.

The operands should be defined as follows:

1 - a string to be padded;

2 - the total number of characters in the resulting string, including padding characters;

3 - (optional) a Unicode padding character. If not specified, the space character is used for padding. If a string is passed as this operand, its first character is used for padding.

To create the PadLeft operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“PadLeft(Field1, Field2)”) or CriteriaOperator.Parse(“PadLeft(Field1, Field2, Field3)”).

PadRight

Pads a string with spaces or a specified Unicode character on the right for a specified total length.

The operands should be defined as follows:

1 - a string to be padded;

2 - the total number of characters in the resulting string, including padding characters;

3 - (optional) a Unicode padding character. If not specified, the space character is used for padding. If a string is passed as this operand, its first character is used for padding.

To create the PadRight operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“PadRight(Field1, Field2)”) or CriteriaOperator.Parse(“PadRight(Field1, Field2, Field3)”).

StartsWith

Returns True if the beginning of one string matches another string; otherwise, False is returned.

This function requires two string operands:

1 - a string to be searched;

2 - a substring to search at the beginning of the first string.

To create the StartsWith operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“StartsWith(String, SubString)”);

EndsWith

Returns True if the end of one string matches another string; otherwise, False is returned.

This function requires two string operands:

1 - a string to be searched;

2 - a substring to search at the end of the first string.

To create the EndsWith operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“EndsWith(String, SubString)”);

Contains

Returns True if one string occurs within another string; otherwise, False is returned.

This function requires two string operands:

1 - a string to be searched;

2 - a substring to search.

To create the Contains operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“Contains(String, SubString)”);

ToInt

Converts a numeric operand to an integer representation.

To create the ToInt operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“ToInt(Field2)”).

Note that the resulting value may vary, based on the database system used as the backend.

ToLong

Converts a numeric operand to a long integer representation.

To create the ToLong operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“ToLong(Field2)”).

Note that the resulting value may vary, based on the database system used as the backend.

ToFloat

Converts a numeric operand to a floating-point (approximate-value) representation.

To create the ToFloat operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“ToFloat(Field2)”).

Note that the resulting value may vary, based on the database system used as the backend.

ToDouble

Converts a numeric operand to a double-precision floating-point (approximate-value) representation.

To create the ToDouble operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“ToDouble(Field2)”).

Note that the resulting value may vary, based on the database system used as the backend.

ToDecimal

Converts a numeric operand to a fixed-point (exact-value) representation.

To create the ToDecimal operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“ToDecimal(Field2)”).

Note that the resulting value may vary, based on the database system used as the backend.

LocalDateTimeThisYear

Returns the DateTime value corresponding to the first day of the current year.

LocalDateTimeThisMonth

Returns the DateTime value corresponding to the first day of the current month.

LocalDateTimeLastWeek

Returns the DateTime value corresponding to the first day of the previous week.

LocalDateTimeThisWeek

Returns the DateTime value corresponding to the first day of the current week.

LocalDateTimeYesterday

Returns the DateTime value corresponding to Yesterday.

LocalDateTimeToday

Returns the DateTime value corresponding to Today.

LocalDateTimeNow

Returns the DateTime value corresponding to the current moment in time.

LocalDateTimeTomorrow

Returns the DateTime value corresponding to Tomorrow.

LocalDateTimeDayAfterTomorrow

Returns the DateTime value corresponding to the day after Tomorrow.

LocalDateTimeNextWeek

Returns the DateTime value corresponding to the first day of the following week.

LocalDateTimeTwoWeeksAway

Returns the DateTime value corresponding to the first day of the week after next.

LocalDateTimeNextMonth

Returns the DateTime value corresponding to the first day of next month.

LocalDateTimeNextYear

Returns the DateTime value corresponding to the first day of the following year.

LocalDateTimeTwoMonthsAway

Returns the DateTime value corresponding to the first day of the month after next.

LocalDateTimeTwoYearsAway

Returns the DateTime value corresponding to the first day of the year after next.

LocalDateTimeLastMonth

Returns the DateTime value corresponding to the first day of the previous month.

LocalDateTimeLastYear

Returns the DateTime value corresponding to the first day of the previous year.

LocalDateTimeYearBeforeToday

Returns the DateTime value corresponding to the day one year ago.

IsOutlookIntervalBeyondThisYear

The Boolean Is Beyond This Year operator for date/time values. Requires one argument.

The operator is defined as follows: date >= First Day of Next Year

IsOutlookIntervalLaterThisYear

The Boolean Is Later This Year operator for date/time values. Requires one argument.

The operator is defined as follows: First Day of Next Month <= date < First Day of Next Year

IsOutlookIntervalLaterThisMonth

The Boolean Is Later This Month operator for date/time values. Requires one argument.

The operator is defined as follows: Last Day of Next Week < date < First Day of Next Month

IsOutlookIntervalNextWeek

The Boolean Is Next Week operator for date/time values. Requires one argument.

The operator is defined as follows: First Day of Next Week <= date <= Last Day of Next Week

IsOutlookIntervalLaterThisWeek

The Boolean Is Later This Week operator for date/time values. Requires one argument.

The operator is defined as follows: Day After Tomorrow <= date < First Day of Next Week

IsOutlookIntervalTomorrow

The Boolean Is Tomorrow operator for date/time values. Requires one argument.

IsOutlookIntervalToday

The Boolean Is Today operator for date/time values. Requires one argument.

IsOutlookIntervalYesterday

The Boolean Is Yesterday operator for date/time values. Requires one argument.

IsOutlookIntervalEarlierThisWeek

The Boolean Is Earlier This Week operator for date/time values. Requires one argument.

The operator is defined as follows: First Day of This Week <= date < Yesterday

IsOutlookIntervalLastWeek

The Boolean Is Last Week operator for date/time values. Requires one argument.

The operator is defined as follows: First Day of Last Week <= date < First Day of This Week

IsOutlookIntervalEarlierThisMonth

The Boolean Is Earlier This Month operator for date/time values. Requires one argument.

The operator is defined as follows: First Day of This Month <= date < First Day of Last Week

IsOutlookIntervalEarlierThisYear

The Boolean Is Earlier This Year operator for date/time values. Requires one argument.

The operator is defined as follows: First Day of This Year <= date < First Day of This Month

IsOutlookIntervalPriorThisYear

The Boolean Is Prior This Year operator for date/time values. Requires one argument.

The operator is defined as follows: date < First Day of This Year

IsThisWeek

Returns True if the specified date falls within the current week.

To create the IsThisWeek operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“IsThisWeek(StartDate)”).

IsThisMonth

Returns True if the specified date falls within the current month.

To create the IsThisMonth operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“IsThisMonth(StartDate)”).

IsThisYear

Returns True if the specified date falls within the current year.

To create the IsThisYear operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“IsThisYear(StartDate)”).

IsNextMonth

Returns True if the specified date falls within the next month.

IsNextYear

Returns True if the specified date falls within the next year.

IsLastMonth

Returns True if the specified date falls within the previous month.

IsLastYear

Returns True if the specified date falls within the previous year.

IsYearToDate

Returns True if the specified date falls within the year-to-date period. This period starts from the first day of the current year and continues up to the current date (including this current date).

IsSameDay

Returns True if the specified date/time values fall within the same day.

IsJanuary

Returns True if the specified date falls within January.

IsFebruary

Returns True if the specified date falls within February.

IsMarch

Returns True if the specified date falls within March.

IsApril

Returns True if the specified date falls within April.

IsMay

Returns True if the specified date falls within May.

IsJune

Returns True if the specified date falls within June.

IsJuly

Returns True if the specified date falls within July.

IsAugust

Returns True if the specified date falls within August.

IsSeptember

Returns True if the specified date falls within September.

IsOctober

Returns True if the specified date falls within October.

IsNovember

Returns True if the specified date falls within November.

IsDecember

Returns True if the specified date falls within December.

DateDiffTick

Returns the count of tick boundaries crossed between the specified starting date and ending date.

The operands should be defined as follows:

1 - a DateTime object representing the starting date;

2 - a DateTime object representing the ending date.

To create the DateDiffTick operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“DateDiffTick(StartDate, EndDate)”).

DateDiffSecond

Returns the count of second boundaries crossed between the specified starting date and ending date.

The operands should be defined as follows:

1 - a DateTime object representing the starting date;

2 - a DateTime object representing the ending date.

To create the DateDiffSecond operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“DateDiffSecond(StartDate, EndDate)”).

DateDiffMilliSecond

Returns the count of millisecond boundaries crossed between the specified starting date and ending date.

The operands should be defined as follows:

1 - a DateTime object representing the starting date;

2 - a DateTime object representing the ending date.

To create the DateDiffMilliSecond operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“DateDiffMilliSecond(StartDate, EndDate)”).

DateDiffMinute

Returns the count of minute boundaries crossed between the specified starting date and ending date.

The operands should be defined as follows:

1 - a DateTime object representing the starting date;

2 - a DateTime object representing the ending date.

To create the DateDiffMinute operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“DateDiffMinute(StartDate, EndDate)”).

DateDiffHour

Returns the count of hour boundaries crossed between the specified starting date and ending date.

The operands should be defined as follows:

1 - a DateTime object representing the starting date;

2 - a DateTime object representing the ending date.

To create the DateDiffHour operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“DateDiffHour(StartDate, EndDate)”).

DateDiffDay

Returns the count of day boundaries crossed between the specified starting date and ending date.

The operands should be defined as follows:

1 - a DateTime object representing the starting date;

2 - a DateTime object representing the ending date.

To create the DateDiffDay operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“DateDiffDay(StartDate, EndDate)”).

DateDiffMonth

Returns the count of month boundaries crossed between the specified starting date and ending date.

The operands should be defined as follows:

1 - a DateTime object representing the starting date;

2 - a DateTime object representing the ending date.

To create the DateDiffMonth operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“DateDiffMonth(StartDate, EndDate)”).

DateDiffYear

Returns the count of year boundaries crossed between the specified starting date and ending date.

The operands should be defined as follows:

1 - a DateTime object representing the starting date;

2 - a DateTime object representing the ending date.

To create the DateDiffYear operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“DateDiffYear(StartDate, EndDate)”).

GetDate

Returns the date part of a specified date.

This operator requires an operand of the DateTime type.

The return value represents a DateTime object with the same date part, and the time part set to 00:00:00.

To create the GetDate operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“GetDate(Field1)”).

GetMilliSecond

Gets the milliseconds part of a specified date.

This operator requires an operand of the DateTime type.

The return value ranges between 0 and 999.

To create the GetMilliSecond operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“GetMilliSecond(Field1)”).

GetSecond

Gets the seconds part of a specified date.

This operator requires an operand of the DateTime type.

The return value ranges between 0 and 59.

To create the GetSecond operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“GetSecond(Field1)”).

GetMinute

Gets the minute part of a specified date.

This operator requires an operand of the DateTime type.

The return value ranges between 0 and 59.

To create the GetMinute operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“GetMinute(Field1)”).

GetHour

Gets the hour part of a specified date.

This operator requires an operand of the DateTime type.

The return value ranges between 0 and 23.

To create the GetHour operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“GetHour(Field1)”).

GetDay

Gets the day part of a specified date.

This operator requires an operand of the DateTime type.

The return value ranges between 1 and 31.

To create the GetDay operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“GetDay(Field1)”).

GetMonth

Gets the month part of a specified date.

This operator requires an operand of the DateTime type.

The return value ranges between 1 and 12.

To create the GetMonth operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“GetMonth(Field1)”).

GetYear

Gets the year part of a specified date.

This operator requires an operand of the DateTime type.

The return value ranges between 1 and 9999.

To create the GetYear operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“GetYear(Field1)”).

GetDayOfWeek

Gets a specified date’s day of the week.

This operator requires an operand of the DateTime type.

The return value represents a Int32 equivalent of a DayOfWeek enumerated constant representing a day of the week.

To create the GetDayOfWeek operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“GetDayOfWeek(Field1)”).

GetDayOfYear

Gets a specified date’s day of the year.

This operator requires an operand of the DateTime type.

The return value ranges between 1 and 366.

To create the GetDayOfYear operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“GetDayOfYear(Field1)”).

GetTimeOfDay

Gets the time part of a specified date.

This operator requires an operand of the DateTime type.

The return value represents a Int64 object that is equal to the number of 100-nanosecond ticks that have elapsed since midnight.

To create the GetTimeOfDay operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“GetTimeOfDay(Field1)”).

Now

Returns a DateTime object representing the system’s current date and time.

To create the Now operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Now()”).

UtcNow

Returns a DateTime object representing the current Coordinated Universal Time (UTC) date and time.

To create the UtcNow operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“UtcNow()”).

Today

Returns a DateTime object representing the system’s current date. The object’s time part is set to 00:00:00.

To create the Today operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse(“Today()”).

AddTimeSpan

Returns a DateTime object representing the date that is a specified time period from a specific date.

The operands should be defined as follows:

1 - a DateTime object representing the original date;

2 - a TimeSpan object representing the time period from the original date.

To create the AddTimeSpan operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“AddTimeSpan(Field1, Field2)”).

AddTicks

Returns a DateTime object representing the date that is a specified number of ticks from a specific date.

The operands should be defined as follows:

1 - a DateTime object representing the original date;

2 - the time period (in 100-nanosecond ticks) from the original date. This number can be negative or positive.

To create the AddTicks operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“AddTicks(Field1, Field2)”).

AddMilliSeconds

Returns a DateTime object representing the date that is a specified number of milliseconds from a specific date.

The operands should be defined as follows:

1 - a DateTime object representing the original date;

2 - the time period (in milliseconds) from the original date. This number can be negative or positive. Its decimal part is part of a millisecond.

To create the AddMilliSeconds operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“AddMilliseconds(Field1, Field2)”).

AddSeconds

Returns a DateTime object representing the date that is a specified number of seconds from a specific date.

The operands should be defined as follows:

1 - a DateTime object representing the original date;

2 - the time period (in seconds) from the original date. This number can be negative or positive. Its decimal part is part of a second.

To create the AddSeconds operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“AddSeconds(Field1, Field2)”).

AddMinutes

Returns a DateTime object representing the date that is a specified number of minutes from a specific date.

The operands should be defined as follows:

1 - a DateTime object representing the original date;

2 - the time period (in minutes) from the original date. This number can be negative or positive. Its decimal part is part of a minute.

To create the AddMinutes operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“AddMinutes(Field1, Field2)”).

AddHours

Returns a DateTime object representing the date that is a specified number of hours from a specific date.

The operands should be defined as follows:

1 - a DateTime object representing the original date;

2 - the time period (in hours) from the original date. This number can be negative or positive. Its decimal part is part of an hour.

To create the AddHours operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“AddHours(Field1, Field2)”).

AddDays

Returns a DateTime object representing the date that is a specified number of days from a specific date.

The operands should be defined as follows:

1 - a DateTime object representing the original date;

2 - the time period (in days) from the original date. This number can be negative or positive. Its decimal part is part of a day.

To create the AddDays operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“AddDays(Field1, Field2)”).

AddMonths

Returns a DateTime object representing the date that is a specified number of months from a specific date.

The operands should be defined as follows:

1 - a DateTime object representing the original date;

2 - the time period (in months) from the original date. This number can be negative or positive.

To create the AddMonths operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“AddMonths(Field1, Field2)”).

AddYears

Returns a DateTime object representing the date that is a specified number of years from a specific date.

The operands should be defined as follows:

1 - a DateTime object representing the original date;

2 - the time period (in years) from the original date. This number can be negative or positive.

To create the AddYears operator using the CriteriaOperator.Parse method use the following syntax: CriteriaOperator.Parse(“AddYears(Field1, Field2)”).

Remarks

This enumeration contains function types supported by the FunctionOperator operators.

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

Note

There are DevExpress products that extend and/or override this function set. The following table lists the articles that explain how to use functions in these products.

Product Article
Reporting Expression Constants, Operators, and Functions
Dashboard Expression Constants, Operators, and Functions
Pivot Grid Pivot Grid Expression Syntax
eXpressApp Framework Function Criteria Operators

Example

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

Note

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),
   BinaryOperatorType.Greater
   );
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);
See Also