Creatio development guide
PDF
This documentation is valid for Creatio version 7.10.0. We recommend using the newest version of Creatio documentation.

Examples of requests for filter selection

Glossary Item Box

We recommend familiarization with the article "Working with bpm'online objects over the OData protocol using Http request".

The structure $filter of the OData protocol is used to build up data filter conditions.

Links, literals, strings, numbers and logical expressions (true, false) may be used in $filter expressions. $filter expressions support arithmetical, logical operations, grouping operations, operations with strings, date and time .

Logical operators

Template Name Description
eq Equals

All contacts whose [Name] field equals to the 'SomeUserName' value.

Request string :

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ContactCollection?$filter=Name eq 'SomeUserName'

ne Does not equal

All contacts whose [Name] field is not equal to the 'SomeUserName' value.

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ContactCollection?$filter=Name ne 'SomeUserName'

gt More

All contacts whose [BirthDate] field exceeds the '1990-12- 12T12:00' value.

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ContactCollection?$filter=BirthDate gt datetime'1990-12-12T12:00'

ge More or equals

All contacts whose [BirthDate] field exceeds or equals to the '1990-12-12T12:00' value.

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ContactCollection?$filter=BirthDate ge datetime'1990-12-12T12:00'

lt Less

All contacts whose [BirthDate] field is less than the '1990-12- 12T12:00' value.

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ContactCollection?$filter=BirthDate lt datetime'1990-12-12T12:00'

le Less or equals

All contacts whose [BirthDate] field is less or equals to the '1990-12-12T12:00' value.

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ContactCollection?$filter=BirthDate le datetime'1990-12-12T12:00'

and And

All contacts whose [Name] field equals to the 'SomeUserName' value and the [BirthDate] field is less than the '1990-12-12T12:00' value.

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ContactCollection?$filter=Name eq 'SomeUserName' and BirthDate le datetime'1990-12-12T12:00'

or Or

All contacts whose [Name] field equals to the 'SomeUserName' value and the [BirthDate] field is less than the '1990-12-12T12:00' value.

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ContactCollection?$filter=Name eq 'SomeUserName' and BirthDate le datetime'1990-12-12T12:00'

not Not

All contacts whose [Name] field does not end with 'ame'.

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ContactCollection?$filter=not endswith(Name, 'ame')

Arithmetic operators

Template Name Description
add Addition

Select all products, for which the price (the [Price] field) satisfies the condition (Price + 2) = 35.55

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ProductCollection?$filter=Price add 2.00m eq 35.55m

sub Subtraction

Select all products, for which the price (the [Price] field) meets the condition (Price - 2) = 35.55

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ProductCollection?$filter=Price sub 2.00m eq 35.55m

mul Multiplication

Select all products, for which the price (the [Price] field) meets the condition (Price * 2) = 35.55

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ProductCollection?$filter=Price mul 2.00m eq 35.55m

div Division

Select all products, for which the price (the [Price] field) meets the condition (Price / 2) = 35.55

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/ProductCollection?$filter=Price div 2 eq 35.55m

To build up complex conditions of data filter in the $filters structure, various functions may be used:

- arithmetical;

- functions of work with strings;

- functions of work with date and time;

- functions of works with objects collection.

Learn more about these functions in the "Working with bpm'online objects over the OData protocol using Http request" article.

The full list of OData protocol functions is represented in OData official specification.

Operator any

Any operator applies logic expressions to each collection of items and returns a value of true, if an expression is correct for at least one collection item. Any operator will return a true value without an argument, if the collection contains at least one item.

Example.

Select all invoices that contain at least one product with the 'SomeProductName' name.

Request string:

GET <BPMonline application address>/0/ServiceModel/EntityDataService.svc/InvoiceCollection?$filter=InvoiceProductCollectionByInvoice/any(d:d/Product/Name eq 'SomeProductName')

OData protocol data types

You should take into account data types that are filtered upon making queries. The literal character, located in the right part of a logical expression, should be of the same type as the field on the left part. The same rule applies to the use of mathematical functions. Strings, numbers, literal characters that are used in building of the expression, should have equal types of data.

Data type Definition Examples
Edm.Binary

Binary data of fixed or floating length. 

Entry mask: 

binary'[A-Fa-f0-9][A-Fa-f0-9]*'  

X'[Fa-f0-9][A-Fa-f0-9]*' 

NOTE

X and binary are case-sensitive.

The space should be absent between the functional word and the value.

 

Example: X'23AB'

Example: binary'23ABFF'

Edm.Boolean

Represents logical value.

Entry mask: 

true | false 

Example: true

Example: false

Edm.Byte

Represents 8-byte unsigned integer value.

Entry mask:

[0-9]+ 

Example: 255
Edm.DateTime

Represents date and time within the range from 12:00;00 midnight, January 1, 1753 A.D. to 11:59:59 P.M., December 9999 A.D.

Entry mask: 

datetime'yyyy-mm-ddThh:mm[:ss[.fffffff]]'

NOTE

datetime is case-sensitive.

The space should be absent between the functional word and the value.

Example: datetime'2000-12-12T12:00'
Edm.Decimal

Numerical value with fixed accuracy.

This type describes the value within the range from negative 10^255+1 to positive 10^255-1.

Entry mask: 

[0-9]+.[0-9]+M|m 

Example:
2.345M
Edm.Double

Represents numerical value with floating point up to 15 characters.

Entry mask: 

[0-9]+ ((.[0-9]+) | [E[+ | -][0-9]+])d 

Example: 1E+10d 

Example: 2.029d

Example: 2.0d

 

Edm.Single

Represents numerical value with floating point up to 7 characters Entry mask.

Entry mask: 

[0-9]+.[0-9]+f 

Example: 2.0f
Edm.Guid

Represents 128-bit value, unique identifier.

Entry mask:

guid'dddddddd-dddd-dddd-dddd-dddddddddddd',

where d — [A-Fa-f0-9] 

 NOTE

Guid is case-sensitive.

The space should be absent between the functional word and the value.

Example: guid'12345678-aaaa-bbbb-cccc-ddddeeeeffff'
Edm.Int16

Represents signed 16-bit value. 

Entry mask: 

[-][0-9]+ 

Example: 16

Example: -16

Edm.Int32

Represents signed 32-bit integer value. 

Entry mask: 

[-] [0-9]+ 

Example: 32

Example: -32

Edm.Int64

Represents signed 64-bit integer value. 

Entry mask:

[-] [0-9]+L 

Example: 64L

Example: -64L

Edm.SByte

Represents signed 8-bit integer value.

Entry mask: 

[-] [0-9]+ 

Example: 8

Example: -8

Edm.String

Character data of floating or fixed length.

Entry mask:

'<any UTF-8 character>'  

Example: 'Hello OData'

 

 

© bpm'online 2002-2017.

Did you find this information useful?

How can we improve it?