Skip to main content

FunctionOperatorType Enum

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

Namespace: DevExpress.Data.Filtering

Assembly: DevExpress.Data.v23.2.dll

NuGet Package: DevExpress.Data

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 are constants. A custom operation is executed on the server side only if its operands cannot be evaluated locally. For more information on how to implement custom operators, review the following help topic: How to: Implement a Custom Criteria Language Function Operator.

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.

For more information on how to implement custom operators, review the following help topic: How to: Implement a Custom Criteria Language Function Operator.

Iif

Returns one of the specified values depending upon the values of logical expressions.

The function can take 2N+1 arguments (where N is 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.

  • The last argument specifies the value that is returned if the previously evaluated logical expressions yield False.

  • If you pass only one argument, the passed argument is returned.

  • If you compare a 0 (zero) with a Null value, the 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 returned value depends on the number of arguments.

If a single operand is passed, the function returns True if the operand is null; otherwise, False.

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

IsNullOrEmpty

Returns True if the specified value is null or an empty string. Otherwise, returns False.

Trim

Returns a string that is a copy of the specified string with all white-space characters removed from the start and end of the specified string.

Len

Returns the length of the string specified by an operand.

To create the Len operator using the CriteriaOperator.Parse method, use the following syntax: CriteriaOperator.Parse("Len(Field1)").

Substring

Returns a substring from the specified string. This function requires two or three operands.

If two operands are passed, the substring starts from the beginning of the specified string. The operands are:

1 - the source string.

2 - an integer that specifies the zero-based position at which the substring starts.

If three operands are passed, a substring starts from the specified position in the source string. The operands are:

1 - the source string.

2 - an integer that specifies the zero-based position at which the substring starts.

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

Upper

Converts all characters in a string operand to uppercase in an invariant culture.

Lower

Converts all characters in a string operand to lowercase in an invariant culture.

Concat

Concatenates the specified strings.

Ascii

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

If the argument is an empty string, the null value is returned.

Char

Converts a numeric operand to a Unicode character.

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

ToStr

Returns a string representation of the specified value or property.

If the operand cannot be converted to a string, the NotSupportedException is thrown.

Replace

Returns a new string in which all occurrences of one specified string (string1) in another string (string2) are replaced with the specified string (string3).

The operands are:

1 - the string in which replacements are made.

2 - the string to be replaced.

3 - the string to replace all occurrences of the specified string.

Reverse

Returns a string in which the character order of a specified string is reversed.

Insert

Returns a new string in which a specified string is inserted at a specified index position into another specified string.

The operands are:

1 - the string into which another string should be inserted.

2 - the zero-based index position of the insertion.

3 - the string to insert.

CharIndex

Returns the index of the first occurrence of a specified string within another string.

The operands are:

1 - a string that you want to find in another string.

2 - a string that contains the string you are searching for.

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.

Remove

Returns a new string with the specified number of characters in the specified string removed, starting at the specified position.

The operands are:

1 - the string that needs to be shortened.

2 - 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.

Abs

Returns the absolute value of a numeric operand.

If the operand is not numeric, the NotSupportedException is thrown.

Sqr

Returns the square root of a specified numeric operand.

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

Cos

Returns the cosine of the numeric operand, in radians.

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

Sin

Returns the sine of the numeric operand, in radians.

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

Atn

Returns the arctangent (the inverse tangent function) of the numeric operand. The arctangent is the angle in the range -π/2 to π/2 radians, whose tangent is the numeric operand.

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

Exp

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

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

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

Log

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

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

If two operands are passed, the function returns the logarithm of the specified operand to the specified base. The operands are:

1 - a number whose logarithm is to be calculated.

2 - the base of the logarithm.

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

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

Rnd

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

Tan

Returns the tangent of the specified numeric operand that is an angle in radians.

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

Power

Returns a specified numeric operand raised to a specified power.

The operands are:

1 - the base number.

2 - the exponent to which the base number is raised.

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

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

Sign

Returns an integer that indicates the sign of a number. The function returns 1 for positive numbers, -1 for negative numbers, and 0 (zero) if a number is equal to zero.

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

Round

Rounds a specified numeric operand to the nearest integer or to a specified number of fractional digits.

The operands are:

1 - a value to round.

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

Ceiling

Returns the smallest integral value greater than or equal to the specified numeric operand.

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

Floor

Returns the largest integral value less than or equal to the specified numeric operand.

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

Max

Returns the larger of two numeric values.

Min

Returns the smaller of two numeric values.

Acos

Returns the arccosine of the numeric operand. The arccosine is the angle in the range 0 (zero) to π radians, whose cosine is the numeric operand.

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

Asin

Returns the arcsine of the numeric operand. The arcsine is the angle in the range -π/2 to π/2 radians, whose sine is the numeric operand.

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

Atn2

Returns the arctangent (the inverse tangent function) of the quotient of the two specified numeric operands. The arctangent is the angle in the range -π/2 to π/2 radians.

The operands are:

1 - the y coordinate of a point in Cartesian coordinates (x, y).

2 - the x coordinate of a point in Cartesian coordinates (x, y).

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

BigMul

Calculates the full product of two integer operands.

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

Cosh

Returns the hyperbolic cosine of the numeric operand, in radians.

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

Log10

Returns the base 10 logarithm of the specified numeric operand.

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

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

Sinh

Returns the hyperbolic sine of the numeric operand, in radians.

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

Tanh

Returns the hyperbolic tangent of a specified numeric operand that is an angle in radians.

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

PadLeft

Returns a new string that pads the character in the specified string on the left with a specified Unicode character, for a specified total length.

The operands are:

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.

PadRight

Returns a new string of a specified length in which the end of a specified string is padded with spaces or with a specified Unicode character.

The operands are:

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.

StartsWith

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

The operands are:

1 - a string to test.

2 - a string to match the beginning of another string.

EndsWith

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

The operands are:

1 - a string that contains the string you are searching for.

2 - a string to compare to the substring at the end of another string.

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

Contains

Returns True if the specified string occurs within another specified string; otherwise, False.

The operands are:

1 - a string that contains the string you are searching for.

2 - a string that you want to find in another string.

ToInt

Converts a numeric operand to an integer value.

ToLong

Converts a numeric operand to a long integer value.

ToFloat

Converts a numeric operand to a floating-point value.

ToDouble

Converts a numeric operand to a double value.

ToDecimal

Converts a numeric operand to a decimal value.

LocalDateTimeThisYear

Returns the DateTime value with the date part that is the first day of the current year, and the time part of 00:00:00.

LocalDateTimeThisMonth

Returns the DateTime value with the date part that is the first day of the current month, and the time part of 00:00:00.

LocalDateTimeLastWeek

Returns the DateTime value that has the date part that is 7 days before the start of the current week, and the time part of 00:00:00.

LocalDateTimeThisWeek

Returns the DateTime value with the date part that is the first day of the current week, and the time part of 00:00:00.

LocalDateTimeYesterday

Returns the DateTime value with the date part that is the previous day, and the time part of 00:00:00.

LocalDateTimeToday

Returns the DateTime value with the date part that is the start of the current day, and the time part of 00:00:00.

LocalDateTimeNow

Returns the DateTime value that is the current moment in time.

LocalDateTimeTomorrow

Returns the DateTime value with the date part that is the next day, and the time part of 00:00:00.

LocalDateTimeDayAfterTomorrow

Returns the DateTime value that has the date part that is two days after the current date, and the time part of 00:00:00.

LocalDateTimeNextWeek

Returns the DateTime value that has the date part that is 7 days after the start of the current week, and the time part of 00:00:00.

LocalDateTimeTwoWeeksAway

Returns the DateTime value with the date part that is the first day of the week after the next week, and the time part of 00:00:00.

LocalDateTimeNextMonth

Returns the DateTime value that has the date part that is the first day of the next month, and the time part of 00:00:00.

LocalDateTimeNextYear

Returns the DateTime value with the date part that corresponds to the first day of the next year, and the time part of 00:00:00.

LocalDateTimeTwoMonthsAway

Returns the DateTime value with the date part that is the first day of the month after the next month, and the time part of 00:00:00.

LocalDateTimeTwoYearsAway

Returns the DateTime value with the date part that is the first day of the year after the next year, and the time part of 00:00:00.

LocalDateTimeLastMonth

Returns the DateTime value that has the date part that is one month before the current date, and the time part of 00:00:00.

LocalDateTimeLastYear

Returns the DateTime value that has the date part that is the first day of the previous year, and the time part of 00:00:00.

LocalDateTimeYearBeforeToday

Returns the DateTime value with the date part that is the date one year ago, and the time part of 00:00:00.

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.

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.

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 period that starts from the first day of the current year and continues until the current date (including the current date).

IsSameDay

Returns True if the specified date/time value falls within the same day.

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

InRange
InDateRange
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 number of tick boundaries between the specified dates.

The operands are:

1 - the DateTime value that is the start date.

2 - the DateTime value that is the end date.

DateDiffSecond

Returns the number of second boundaries between the specified dates.

The operands are:

1 - the DateTime value that is the start date.

2 - the DateTime value that is the end date.

DateDiffMilliSecond

Returns the number of millisecond boundaries between the specified dates.

The operands are:

1 - the DateTime value that is the start date.

2 - the DateTime value that is the end date.

DateDiffMinute

Returns the number of minute boundaries between the specified dates.

The operands are:

1 - the DateTime value that is the start date.

2 - the DateTime value that is the end date.

DateDiffHour

Returns the number of hour boundaries between the specified dates.

The operands are:

1 - the DateTime value that is the start date.

2 - the DateTime value that is the end date.

DateDiffDay

Returns the number of day boundaries between the specified dates.

The operands are:

1 - the DateTime value that is the start date.

2 - the DateTime value that is the end date.

DateDiffMonth

Returns the number of month boundaries between the specified dates.

The operands are:

1 - the DateTime value that is the start date.

2 - the DateTime value that is the end date.

DateDiffYear

Returns the number of year boundaries between the specified dates.

The operands are:

1 - the DateTime value that is the start date.

2 - the DateTime value that is the end date.

GetDate

Returns the date part of the specified date.

The operand must be of the DateTime type.

The return value is a DateTime object with the same date part. The time part is 00:00:00.

GetMilliSecond

Returns the milliseconds value in the specified date.

The operand must be of the DateTime type.

The return value is an integer in the range between 0 and 999.

GetSecond

Returns the seconds value in the specified date.

The operand must be of the DateTime type.

The return value is an integer in the range between 0 and 59.

GetMinute

Returns the minutes value in the specified date.

The operand must be of the DateTime type.

The return value is an integer in the range between 0 and 59.

GetHour

Returns the hours value in the specified date.

The operand must be of the DateTime type.

The return value is an integer in the range between 0 and 23.

GetDay

Gets the day of the month in the specified date.

The operand must be of the DateTime type.

The return value is an integer in the range between 1 and 31.

GetMonth

Gets the month in the specified date.

The operand must be of the DateTime type.

The return value is an integer and depends on the current calendar.

GetYear

Gets the year in the specified date.

The operand must be of the DateTime type.

The return value is an integer in the range between 1 and 9999.

GetDayOfWeek

Gets the day of the week in the specified date.

The operand must be of the DateTime type.

The return value is an integer value of the DayOfWeek enumeration. It does not depend on the current culture.

GetDayOfYear

Gets the day of the year in the specified date.

The operand must be of the DateTime type.

The return value is an integer in the range between 1 and 366.

GetTimeOfDay

Gets the time part of the specified date.

The operand must be of the DateTime type.

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

Now

Returns the DateTime value that is the current date and time.

UtcNow

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

Today

Returns a DateTime value that is the current date. The time part is set to 00:00:00.

AddTimeSpan

Returns a DateTime value that differs by a specified amount of time from a specified date.

The operands are:

1 - the DateTime value that is the start date.

2 - the TimeSpan object that is the time period before or after the start date.

AddTicks

Returns a DateTime value that is the specified number of ticks before or after a specified start date.

The operands are:

1 - the DateTime value that is the start date.

2 - the integer number that is the number of 100-nanosecond ticks. This number can be negative or positive.

AddMilliSeconds

Returns a DateTime value that is the specified number of milliseconds before or after a specified start date.

The operands are:

1 - the DateTime value that is the start date.

2 - the Double value that is the number of milliseconds before or after the start date. This number can be negative or positive. Its decimal part is a fraction of a millisecond.

AddSeconds

Returns a DateTime value that is the specified number of seconds before or after a specified start date.

The operands are:

1 - the DateTime value that is the start date.

2 - the Double value that is the number of seconds before or after the start date. This number can be negative or positive. Its decimal part is a fraction of a second.

AddMinutes

Returns a DateTime value that is the specified number of minutes before or after a specified start date.

The operands are:

1 - the DateTime value that is the start date.

2 - the Double value that is the number of minutes before or after the start date. This number can be negative or positive. Its decimal part is a fraction of a minute.

AddHours

Returns a DateTime value that is the specified number of days before or after a specified start date.

The operands are:

1 - the DateTime value that is the start date.

2 - the Double value that is the number of hours before or after the start date. This number can be negative or positive. Its decimal part is a fraction of an hour.

AddDays

Returns a DateTime value that is the specified number of days before or after a specified start date.

The operands are:

1 - the DateTime value that is the start date.

2 - the Double value that is the number of days before or after the start date. This number can be negative or positive. Its decimal part is a fraction of a day.

AddMonths

Returns a DateTime value that is the specified number of months before or after a specified start date.

The operands are:

1 - the DateTime value that is the start date.

2 - the integer value that is the number of months before or after the start date. This number can be negative or positive.

AddYears

Returns a DateTime value that is the specified number of years before or after a specified start date.

The operands are:

1 - the DateTime value that is the start date.

2 - the integer value that is the number of years before or after the start date. This number can be negative or positive.

DateTimeFromParts

Returns a date value constructed from the specified Year, Month, Day, Hour, Minute, Second, and Millisecond.

The operands are:

1 - (Required) - an integer value that is the full year value (four digits, century included).

2 - (Required) - an integer value that is the month number (1-12).

3 - (Required) - an integer value that is the day of the month (1-31).

4 - (Optional) - an hour value in 24-hour format (0-23).

5 - (Optional) - a minute value (0-59).

6 - (Optional) - a second value (0-59).

7 - (Optional) - a millisecond value.

Related API Members

The following properties accept/return FunctionOperatorType values:

Remarks

This enumeration contains function types supported by the FunctionOperator operators.

You can 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 topics 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