Skip to main content
Version: 10.0

Filters class

Level: advanced

During the execution of DataService operations, it is often necessary to filter data. For example, when reading section records, you need to fetch only those records that meet certain criteria. Creatio provides the Filters class to form these criteria.

Filters class

The Filters class is defined in the Terrasoft.Nui.ServiceModel.DataContract namespace of the Terrasoft.Nui.ServiceModel.dll class library. For simplicity, the hierarchical structure of the Filters data filter is conveniently presented as a JSON format object:

Structure of the Filters data filter
"Filters":{
"RootSchemaName":["Root schema name"],
"FilterType":[Filter type],
"ComparisonType":[Comparison type],
"LogicalOperation":[Logical operation],
"IsNull":[Null check flag],
"IsEnabled":[Activation flag],
"IsNot":[Negation operator flag],
"SubFilters":[Subquery filters],
"Items":[Filter group collection],
"LeftExpression":[Expression to be checked],
"RightExpression":[Filtration expression],
"RightExpressions":[Filtration expressions array],
"RightLessExpression":[Initial filtration range expression],
"RightGreaterExpression":[Final filtration range expression],
"TrimDateTimeParameterToDate":[Cutting time for date/time parameters flag],
"Key":["Filter key in the filter collection"],
"IsAggregative":[Aggregating filter flag],
"LeftExpressionCaption":["Expression title to be checked"],
"ReferenceSchemaName":["Reference schema name"]
}

string RootSchemaName

The name of the root object schema.


FilterType FilterType

Filter type. Set by the FilterType enumeration value of the Terrasoft.Nui.ServiceModel.DataContract namespace.

Available values

Value

Type

Description

0

None

Filter type not defined.

1

CompareFilter

Comparison filter. Used to compare expression results.

2

IsNullFilter

The filter that defines whether an expression is empty.

3

Between

The filter that defines whether an expression is one of the expressions.

4

InFilter

The filter that defines whether an expression equals one of the expressions.

5

Exists

Existence filter.

6

FilterGroup

Filter group. Filter groups can be nested in one another, i.e., the collection itself can be an element of another collection.

7

Segment

Segment membership filter. Requires the UseSegmentFiltering additional feature to be enabled. Learn more: Filter segments.


FilterComparisonType ComparisonType

Comparison operation type. Set by the FilterComparisonType enumeration value of the Terrasoft.Core.Entities namespace.

Available values

Value

Type

0

Between

1

IsNull

2

IsNotNull

3

Equal

4

NotEqual

5

Less

6

LessOrEqual

7

Greater

8

GreaterOrEqual

9

StartWith

11

Contain

13

EndWith

15

Exists

16

NotExists


LogicalOperationStrict LogicalOperation

Logical operation. This type does not allow the None value specified in the LogicalOperationStrict enumeration of the Terrasoft.Common namespace.

Available values

Value

Type

Description

0

And

All child filters must match.

1

Or

Any child filter must match.


bool IsNull

Determines whether the expression is null.

Available values

Value

Description

true

The filter checks whether the expression is null.

false

The filter does not check whether the expression is null.


bool IsEnabled

Determines whether the filter is active and taken into account when building a request.

Available values

Value

Description

true

The filter is active and taken into account when building the request.

false

The filter is inactive and excluded when building the request.


bool IsNot

Determines whether to use the negation logical operator.

Available values

Value

Description

true

Creatio applies the negation logical operator to the filter.

false

Creatio does not apply the negation logical operator.


Filters SubFilters

Subrequest filters. Cannot contain filters with other subrequests.


Dictionary<string, Filter> Items

Collection containing a filter group.


BaseExpression LeftExpression

The expression in the left part of the comparison, i.e. the expression to be tested. The BaseExpression class is defined in the Terrasoft.Nui.ServiceModel.DataContract namespace.


BaseExpression RightExpression

The filter expression that will be compared to the expression contained in the LeftExpression property.


BaseExpression[] RightExpressions

The expression array that will be compared to the expression contained in the LeftExpression property.


BaseExpression RightLessExpression

Initial filtration range expression.


BaseExpression RightGreaterExpression

Final filtration range expression.


bool TrimDateTimeParameterToDate

Determines whether to cut time from the date-time parameters.

Available values

Value

Description

true

Creatio trims the time portion from date-time parameters.

false

Creatio keeps the time portion of date-time parameters.


string Key

Filter key in the collection of Items filters.


bool IsAggregative

Determines whether the filter is aggregating.

Available values

Value

Description

true

The filter is aggregating.

false

The filter is not aggregating.


string LeftExpressionCaption

Left comparison part title.


string ReferenceSchemaName

The object schema name referenced by the left part of the filter if the column type is "Lookup."


BaseExpression class

The BaseExpression class is the base expression class. It is defined in the Terrasoft.Nui.ServiceModel.DataContract namespace of the Terrasoft.Nui.ServiceModel library. The properties of this class instance are populated depending on the ExpressionType property that specifies the expression type. A complete list of the BaseExpression class properties is given in the table.


EntitySchemaQueryExpressionType ExpressionType

The expression type that defines the value that will be contained in the added column. Set by the EntitySchemaQueryExpressionType enumeration of the Terrasoft.Core.Entities namespace defined in the Terrasoft.Core class library. For the InsertQuery the EntitySchemaQueryExpressionType.Parameter value is set.

Available values

Value

Type

0

SchemaColumn

1

Function

2

Parameter

3

SubQuery

4

ArithmeticOperation


string ColumnPath

The path to a column relative to the root schema.


Parameter Parameter

Defines the value that will be contained in the added column. Its Parameter type is defined in the Terrasoft.Nui.ServiceModel.DataContract namespace.


FunctionType FunctionType

Function type. Set by the value from the FunctionType enumeration defined in the Terrasoft.Nui.ServiceModel.DataContract namespace.

Available values

Value

Type

0

None

1

Macros

2

Aggregation

3

DatePart

4

Length


EntitySchemaQueryMacrosType MacrosType

Macro type. Set by the value from the EntitySchemaQueryMacrosType enumeration defined in the Terrasoft.Core.Entities namespace.


BaseExpression FunctionArgument

Function argument. Takes the value if the function is defined with a parameter. The BaseExpression class is defined in the Terrasoft.Nui.ServiceModel.DataContract namespace and is the ancestor of the ColumnExpression class and has the same set of properties.


DatePart DatePartType

Date part. Set by the value from the DatePart enumeration defined in the Terrasoft.Nui.ServiceModel.DataContract namespace.

Available values

Value

Type

0

None

1

Day

2

Week

3

Month

4

Year

5

Weekday

6

Hour

7

HourMinute


AggregationType AggregationType

Aggregating function type. Sets the value of AggregationType enumeration defined in the namespace Terrasoft.Common defined in the class library Terrasoft.Common.


AggregationEvalType AggregationEvalType

Aggregating function type. Set by the value from the AggregationEvalType enumeration defined in the Terrasoft.Core.DB namespace defined in the Terrasoft.Core class library.


Filters SubFilters

Subquery filter collection. Its Filters type is defined in the Terrasoft.Nui.ServiceModel.DataContract namespace.


See also

Filter object

Manage segments using Segmentation Engine API