Conditions of sorting the valid values¶
Description¶
Conditions for selecting allowed values are conditions that allow you to limit the selection of objects by reference that are allowed for binding in this reference attribute.
Filter of sorting the valid values is used in the meta class for the attributes of the “Reference” and “Collection” types. The filter sets the conditions to limit the sample of objects. Conditions are imposed as a list of consecutive operations.
Available operations:¶
• EQUAL: 0, // равно =
• NOT_EQUAL: 1, // не равно <>
• EMPTY: 2, // пусто '' или null
• NOT_EMPTY: 3, // не пусто !'' или !null
• LIKE: 4, // похож
• LESS: 5, // меньше <
• MORE: 6, // больше >
• LESS_OR_EQUAL: 7, // меньше или равно <=
• MORE_OR_EQUAL: 8, // больше или равно >=
• IN: 9, // элемент входит в коллекцию/массив (IN)
• CONTAINS: 10 // содержит
module.exports = {
AND: 0,
OR: 1,
NOT: 2,
MIN: 3,
MAX: 4,
AVG: 5,
SUM: 6,
COUNT: 7
};
Description of operations¶
All operations can be divided into groups according to the properties in the condition:
The attribute is not set in the condition and the condition is the object
- nestedConditions does not contain following conditions
- Aggregation operations
AgregOpers
- MIN
- MAX
- AVG
- SUM
- COUNT
- Aggregation operations
- nestedConditions contains following conditions
- Logical operations of comparison of nested conditions
BoolOpers
- OR
- NOT
- Logical operations of comparison of nested conditions
The attribute is set in the condition and the condition is the object: operations of comparison of the attribute value in the condition with the value in the “value” field
- EMPTY
- NOT_EMPTY
- CONTAINS
- EQUAL
- NOT_EQUAL
- LESS
- MORE
- LESS_OR_EQUAL
- MORE_OR_EQUAL
- LIKE
- IN
Condition in the form of an array
- Use the logic operation “AND” to compare the results of conditions (objects in array).
In the operation of the key-expression type, the key is the attribute name in the reference class or in the collection class. Adjacent conditions are combined by a logical “AND” operation (unless another operation is specified) and filters are added to the “selConditions” property.
Application of operations and other features¶
Use the “nestedConditions” to perform the attribute inquiry. A separate operation for each attribute. Do not specify nested reference attributes by a point in the “property” field.
To inquire attribute values that are not equal to zero, use the nempty
operation and specify null
in the “value” field.
The CONTAINS operation is applied to the following attribute types:
- string - the LIKE operation is applied to the data string
- collection
- the IN operation is applied if the compared
value
is an array and contains at least one element - transition to nested conditions
nestedConditions
occurs if the comparedvalue
is not an array or does not contain at least one element in the array
- the IN operation is applied if the compared
JSON¶
{
"selConditions": [
{
"property": "region",
"operation": 10,
"value": "Хабаровский край",
"nestedConditions": [
{
"property": "town",
"operation": 0,
"value": "г Хабаровск",
"nestedConditions": []
}
]
}
]
}
{
"selConditions": [
{
"property": "town",
"operation": 3,
"value": null,
"nestedConditions": []
}
]
}
Field description¶
Field | Name | Acceptable values | Description |
---|---|---|---|
"property" |
Attribute | String only the latin characters with no spaces | The attribute of the reference class by which the values are filtered |
"operation" |
Operation | Operation code (see above) | The operation according to which the filtration is performed |
"value" |
Value | Depends on the type of operation | The second value for binary filtering operations |
"nestedConditions" |
Nested selection conditions | Object, the structure is similar to the structure of the selection conditions object itself. |
Example¶
Attention
Field “selection_provider”. See for more detailes Selection list of valid values.
“type”: “SIMPLE” - simple type,
“list”: [] - an array of acceptable values.
{ "orderNumber": 80, "name": "type", "caption": "Тип организации", "type": 0, "size": null, "decimals": 0, "nullable": true, "readonly": false, "indexed": false, "unique": false, "autoassigned": false, "defaultValue": null, "refClass": "", "itemsClass": "", "backRef": "", "backColl": "", "binding": "", "selConditions": [], "selSorting": [], "selectionProvider": { "type": "SIMPLE", "list": [ { "key": "customer", "value": "Заказчик" }, { "key": "executor", "value": "Исполнитель" } ], "matrix": [], "parameters": [], "hq": "" }, "indexSearch": false, "eagerLoading": false }
Example¶
In the reference attribute, it is necessary to show only those objects that have the “selConditions” attribute set in the reference class and in the property
field of which this attribute specifies the field of the related class whose value in the “value” field corresponds to the “operation” condition.
The aim is to show in the “Organization” attribute only those organizations (“refClass”: “organization”) in which the type field (“property”: “type”) is equal (“operation”: 0) to the customer value (“value”: “customer”).
All conditons in the "selConditions"
are united by “AND” condition.
{
"orderNumber": 120,
"name": "customer",
"caption": "Заказчик",
"type": 13,
"size": null,
"decimals": 0,
"nullable": true,
"readonly": false,
"indexed": false,
"unique": false,
"autoassigned": false,
"defaultValue": null,
"refClass": "organization",
"itemsClass": "",
"backRef": "",
"backColl": "",
"binding": "",
"selConditions": [
{
"property": "type",
"operation": 0,
"value": "customer",
"nestedConditions": []
}
],
"selSorting": [],
"selectionProvider": null,
"indexSearch": false,
"eagerLoading": false
},
{
"orderNumber": 130,
"name": "executor",
"caption": "Исполнитель",
"type": 13,
"size": null,
"decimals": 0,
"nullable": true,
"readonly": false,
"indexed": false,
"unique": false,
"autoassigned": false,
"defaultValue": null,
"refClass": "organization",
"itemsClass": "",
"backRef": "",
"backColl": "",
"binding": "",
"selConditions": [
{
"property": "type",
"operation": 0,
"value": "executor",
"nestedConditions": []
}
],
"selSorting": [],
"selectionProvider": null,
"indexSearch": false,
"eagerLoading": false
}
Conditions of sorting the valid values for “Data” attribute type¶
The core implements the context attribute - $$ now
, which returns the current date. $$ now
is available everywhere if you specify the conditions.
For more details see variables.
Example¶
Condition: to display the objects with the attribute value [dataStart] less than the current data:
{
"property": "dateStart",
"operation": 5,
"value": [
"$$now"
],
"nestedConditions": []
}