Skip to main content
Version: 8.1

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 Namespace Terrasoft.Nui.ServiceModel.DataContract.

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":[Completeness checkbox],
"IsEnabled":[Activation checkbox],
"IsNot":[Negation operator checkbox],
"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 checkbox],
"Key":["Filter key in the filter collection"],
"IsAggregative":[Aggregating filter checkbox],
"LeftExpressionCaption":["Expression title to be checked"],
"ReferenceSchemaName":["Reference schema name"]
}

Properties

RootSchemaName string

A string containing the name of the root object schema of the added record.

FilterType FilterType

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

Available values (FilterType)

None

0

Filter type not defined.

CompareFilter

1

Comparison filter. Used to compare expression results.

IsNullFilter

2

The filter that defines whether an expression is empty.

Between

3

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

InFilter

4

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

Exists

5

Existence filter.

FilterGroup

6

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

ComparisonType FilterComparisonType

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

LogicalOperation LogicalOperationStrict

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

IsNull bool

Expression completion checkbox.

IsEnabled bool

Checkbox that defines whether the filter is active and will be taken into account when building a request.

IsNot bool

Specifies whether to use the negation logical operator.

SubFilters Filters

Subrequest filters. Cannot contain filters with other subrequests.

Items Dictionary<string, Filter>

Collection containing a filter group.

LeftExpression BaseExpression

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.

RightExpression BaseExpression

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

RightExpressions BaseExpression[ ]

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

RightLessExpression BaseExpression

Initial filtration range expression.

RightGreaterExpression BaseExpression

Final filtration range expression.

TrimDateTime ParameterToDate bool

Checkbox indicating whether to cut time from the date-time parameters.

Key string

Filter key in the collection of Items filters.

IsAggregative bool

Aggregating filter checkbox.

LeftExpressionCaption string

Left comparison part title.

ReferenceSchemaName string

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

BaseExpression class

The Namespace Terrasoft.Nui.ServiceModel.DataContract.

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

Properties

ExpressionType EntitySchemaQuery 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 (EntitySchemaQuery ExpressionType)

SchemaColumn

0

Schema column.

Function

1

Function.

Parameter

2

Parameter.

SubQuery

3

Subquery.

ArithmeticOperation

4

Arithmetic operation.

ColumnPath string

The path to a column relative to the root schema. The rules for building the paths can be found in the "The use of EntitySchemaQuery for creation of queries in database" article.

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 (FunctionType)

None

0

Not defined.

Macros

1

Macro.

Aggregation

2

Aggregating function.

DatePart

3

Date part.

Length

4

Length.

MacrosType EntitySchemaQuery MacrosType

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

FunctionArgument BaseExpression

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 ColumnExpresion class and has the same set of properties.

DatePartType DatePart

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

Available values (DatePart)

None

0

Not defined.

Day

1

Day.

Week

2

Week.

Month

3

Month.

Year

4

Year.

Weekday

5

Day of the week.

Hour

6

Hour.

HourMinute

7

Minute.

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 Set by the value from the AggregationEvalType enumeration defined in the Terrasoft.Core.DB namespace defined in the Terrasoft.Core class library.

SubFilters Filters

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