- Home
- JSON
- PagingAndFiltering
The Class PagingAndFiltering.
- Implemented Interfaces
- Serializable
Properties
name |
data type |
description |
fullTextFilter
|
string
|
Full text search filter. Mutually exclusive with filters attribute. fullTextFilter has priority
|
filters
|
map of object
|
Search filters (key = Filter key, value = search pattern or value).
Filter key can be:
- "$FILTER". Value is a filter name
- "type_class". Value is a full classname. Used to limit search results to a particular entity type in case of entity subclasses. Can be combined to condition "ne" to
exclude those classes.
- SQL. Additional sql to apply. Value is either a sql query or an array consisting of sql query and one or more parameters to apply
- <condition> <fieldname1> <fieldname2> ... <fieldnameN>. Value is a value to apply in condition
A union between different filter items is AND.
Condition is optional. Number of fieldnames depend on condition used. If no condition is specified an "equals ignoring case" operation is considered.
Following conditions are supported:
- fromRange. Ranged search - field value in between from - to values. Specifies "from" part value: e.g value<=field.value. Applies to date and number type fields.
- toRange. Ranged search - field value in between from - to values. Specifies "to" part value: e.g field.value<=value
- list. Value is in field's list value. Applies to date and number type fields.
- inList/not-inList. Field value is [not] in value (list). A comma separated string will be parsed into a list if values. A single value will be considered as a list value
of one item
- minmaxRange. The value is in between two field values. TWO field names must be provided. Applies to date and number type fields.
- minmaxOptionalRange. Similar to minmaxRange. The value is in between two field values with either them being optional. TWO fieldnames must be specified.
- overlapOptionalRange. The value range is overlapping two field values with either them being optional. TWO fieldnames must be specified. Value must be an array of two
values.
- likeCriterias. Multiple fieldnames can be specified. Any of the multiple field values match the value (OR criteria). In case value contains *, a like criteria match will
be used. In either case case insensative matching is used. Applies to String type fields.
- wildcardOr. Similar to likeCriterias. A wildcard match will always used. A * will be appended to start and end of the value automatically if not present. Applies to
String type fields.
- ne. Not equal.
Following special meaning values are supported:
- IS_NULL. Field value is null
- IS_NOT_NULL. Field value is not null
To filter by a related entity's field you can either filter by related entity's field or by related entity itself specifying code as value. These two example will do the
same in case when quering a customer account: customer.code=aaa OR customer=aaa
To filter a list of related entities by a list of entity codes use "inList" on related entity field. e.g. for quering offer template by sellers: inList sellers=code1,code2
Note: Quering by related entity field directly will result in exception when entity with a specified code does not exists
Examples:
- invoice number equals "1578AU": Filter key: invoiceNumber. Filter value: 1578AU
- invoice number is not "1578AU": Filter key: ne invoiceNumber. Filter value: 1578AU
- invoice number is null: Filter key: invoiceNumber. Filter value: IS_NULL
- invoice number is not empty: Filter key: invoiceNumber. Filter value: IS_NOT_NULL
- Invoice date is between 2017-05-01 and 2017-06-01: Filter key: fromRange invoiceDate. Filter value: 2017-05-01 Filter key: toRange invoiceDate. Filter value:
2017-06-01
- Date is between creation and update dates: Filter key: minmaxRange audit.created audit.updated. Filter value: 2017-05-25
- invoice number is any of 158AU, 159KU or 189LL: Filter key: inList invoiceNumber. Filter value: 158AU,159KU,189LL
- any of param1, param2 or param3 fields contains "energy": Filter key: wildcardOr param1 param2 param3. Filter value: energy
- any of param1, param2 or param3 fields start with "energy": Filter key: likeCriterias param1 param2 param3. Filter value: *energy
- any of param1, param2 or param3 fields is "energy": Filter key: likeCriterias param1 param2 param3. Filter value: energy
NOTE: Filters passed as string in Rest GET type method are in the following format: filterKey1:filterValue1|filterKey2:filterValue2
|
fields
|
string
|
Data retrieval options/fieldnames separated by a comma.
|
offset
|
number
|
Pagination - from record number.
|
limit
|
number
|
Pagination - number of items to retrieve.
|
sortBy
|
string
|
Sorting - field to sort by - a field from a main entity being searched. See Data model for a list of fields.
|
sortOrder
|
SortOrder
|
Sorting - sort order.
|
multiSortOrder
|
string
|
Sorting - sort order.
|
totalNumberOfRecords
|
number
|
Total number of records. Note - filled on response only.
|
loadReferenceDepth
|
number
|
Depth of loading referenced custom entities, default value is 0 (only referenced entity id is shown)
Every time this value is incremented it will show a new level of entities in details.
|
Example
{
"fullTextFilter" : "...",
"filters" : {
"property1" : { },
"property2" : { }
},
"fields" : "...",
"offset" : 12345,
"limit" : 12345,
"sortBy" : "...",
"sortOrder" : "DESCENDING",
"multiSortOrder" : "...",
"totalNumberOfRecords" : 12345,
"loadReferenceDepth" : 12345
}