A Selector is a set of selection criteria that retrieves the instances of the entity of the unit. Content units defined over entities may require a selector to determine the instances of the entity used to construct their content. The selector contains one or more conditions to a unit or preloaded field. Such conditions are used to make up the query over the data source, which actually determines the instances on which the unit content is based. There are three types of condition:
-
Attributes Condition
-
Key Condition
-
RelationshipRole Condition
Attributes Condition
An Attributes Condition selects only the entity instances for which the value of some attribute satisfies a predicate.
For example, an Attributes Condition for an index unit may be: "include in an index of combinations only the combinations with price less than 300$".
To create an Attributes Condition, right click on the unit to which you want to add a condition or on its selector node in the Outline and select the Add Attributes Condition command. An attributes condition node is added under the selector node of the unit as you can see in the image on the right.
The properties belonging to this condition are:
-
id: The unique identifier of the element
-
Name: The custom element name
-
Attributes: It contains the list of attributes of the condition. If more than one attribute is chosen, the condition is treated a set of as conditions connected by the OR logical operator, each one referring to a distinct attribute.
-
Predicate: The possible property values are:
-
Begins With
-
Begins With (Ignore Case)
-
Contains
-
Contains (Ignore Case)
-
Ends With
-
Ends With (Ignore Case)
-
Equal (default value)
-
Equal (Ignore Case)
-
Greater Than
-
Greater or Equal
-
Is Not Null
-
Is Null
-
Less Than
-
Less or Equal
-
Not Begins With
-
Not Begins With (Ignore Case)
-
Not Contains
-
Not Contains (Ignore Case)
-
Not Ends With
-
Not Ends With (Ignore Case)
-
Not Equal
-
Not Equal (Ignore Case)
-
Boolean Operator: This property chooses the logic which will be applied when the attribute selected contains an array of values. If the "and" option is chosen, each value of the array must satisfy the predicate. If the "or" option is applied instead, only one of the array values can satisfy the predicate. Possible options are:
-
Required. This property states if the condition must be evaluate in the SQL query or not. When the "true" option is chosen, a value must be provided in order to evaluate the condition. If the value is not provided then this condition makes the unit not computed and then no data is displayed to the user. When the "false" value is chosen, when no value is provided for the condition, the condition is simply ignored just as it wasn't defined on the unit. Possible values are:
-
True (default value)
-
False
-
Value. The constant condition value used for the condition comparison. It is not mandatory since the value can also be provided through the coupling.
Key Condition
A Key Condition selects only the entity instances for which the value of some key attribute satisfies a predicate. All the attributes selected as primary key of the entity will be used to evaluate the condition.
To create a Key Condition, right click on the unit to which you want to add a condition or on its selector node in the Outline and select the Add Key Condition command. A key condition node is added under the selector node of the unit.
If you select the Key Condition, in the Properties View you can see the following properties:
-
id: The unique identifier of the element
-
Name: The custom element name
-
Predicate: The property possible values are:
-
In (default value)
-
Not In
-
Required: The property possible values are:
-
True (default value)
-
False
Relationship Role Condition
A RelationshipRole Condition selects only the entity instances that are related to some other entity instance by means of a specific chain of relationship roles.
For example, a relationship-based condition for an index unit may be: "include in this index of combinations only the combinations including some specific products, which is passed in input to the index unit by a link".
To create a RelationshipRole Condition, right click on the unit to which you want to add a condition or on its selector node in the Outline and select the Add Relationship Role Condition command. A relationship role condition node is added under the selector node of the unit.
-
id:The unique identifier of the element
-
Name:The custom element name
-
Role: It contains the relationship role chain of the condition starting from the farthest role.
-
Predicate: The possible property values are:
-
In (default value)
-
Not In
-
Required: The possible property values are:
-
True (default value)
-
False
Default Policy
This property controls the unit's behaviour in case no input parameter is available for all the not required conditions of the unit. The property possible values are:
-
Fill (default value). The content of the unit is filled up in the normal way, i.e. by ignoring the not required selector conditions lacking their input parameter.
-
Empty (only with Not Required).the content of the unit is left empty if the abovementioned pre-condition is satisfied (allowed only if all the selector's conditions are not required).
-
Empty (also with Required). The content of the unit is left empty if the abovementioned pre-condition is satisfied (allowed also if there is one or more required conditions)
Boolean Operator
If the selector needs more than one condition, this property defines whether the different conditions are considered either in conjunction (AND logical operator) or in disjunction (OR logical operator). The property possible values are:
Expression
The complex expression based on the conditions of the selector. For more information about Complex Selector Conditions please refer to this article.