Rule list resolver
Value resolver – Abstract
Purpose: Returns either exactly one entry or all entries from the input value that match the configurable acceptance criteria.
The Rule list resolver returns either exactly one entry or all entries from the input value that match the optionally configurable acceptance criteria, depending on the Resolve all as list option:
The optional selection for the Element type acts as an acceptance criteria in the sense of a Typprüfung at runtime and influences the selection options for rule types and value resolvers in the configuration for the rule.
Without a selection for the Element type, no Typprüfung takes place for the entries from the input value.
The optional addition of a rule via the
icon, defines a freely definable acceptance criterion for entries from the input value.
Without defining a rule, all entries are considered acceptable as long as they match the Element type defined, if any.
►IMPORTANT◄ If the input value is not a list but a single value, it is treated as if it were the only entry in a list.
The Resolve all as list option controls the return value:
If the option is unchecked (default), then the Rule list resolver returns the first entry from the input value that meets all configured acceptance criteria.
If the option is checked, then the Rule list resolver returns all entries from the input value that meet all configurable acceptance criteria.
Regardless of the Resolve all as list option, the Rule list resolver returns 'no value' ($null) if no entry from the input value meets all configured acceptance criteria.
If the option Resolve all as list does not return a match, the return value is not an 'empty list' ([]). Therefore, a Default value value resolver can be concatenated in each case to define a single default value or 'default list' for this case.
Configuration
The Element type selection field allows a static single selection of a specific type or a parent class (in the sense of a Typprüfung) that covers different specific types. As shown in the image, a search function is provided for both the internal names and the localization applicable in context. If an Element type is selected, only entries from the input value that would pass a Typprüfung against the selected class are considered acceptable. Without selecting an Element type, all entries from the input value are considered acceptable. |
|
The Resolve all as list option can be checked to obtain a list of all entries from the input value that meet all acceptance criteria configured by the other optional parameters as return value. A click on the In the example on the right, an Entity property rule was selected to check for entries with the selected Element type 'City' (see City) whether their 'County code' (countyCode) field is filled (see Is empty and not (Matcher). ►NOTE◄ If, due to the context in the configuration, the input value is defined as a list of cities (Ort[]), the Element type 'City' does not have to be explicitly selected to obtain the 'matching' field selection in the Object property value resolver dropdown. However, the additional 'declaration' via the parameter does not hurt then either. The specification of the Element type is decisive, if thereby only a subset of entries from a heterogeneous list (with objects of different classes) is considered to be acceptable. |
|
Examples
Demonstration example: Using the 'Element type' to restrict entries according to type/class affiliation
The configuration shown on the right serves exclusively to demonstrate the effects of different parameters for the Rule list resolver with the same input value. This is defined here in the Object Resolver parameter of an Ausführen mit event action via a Create list value resolver as a list with statically determined entries of different data types:
This list is passed by concatenation as input value to a Rule list resolver. The table compares different parameters and the resulting output (as a string image of the return value). In the configuration, a Show alert (Popup) event action generates this string image by outputting the return value of the value resolver as the Message text. The Title of the message indicates the number of entries in the returned list. |
|
The following table lists different parameters for the Rule list resolver, which are based on the diagram shown on the right:
►NOTE◄ As the diagrams on the right show, the option Resolve all as list together with the selection for the Element type influences the data type for the return value. In this specific case, a list of numerical values (Number[]) is expected as the data type for the return value at the top (with the Resolve all as list option checked), while only a single numerical value (Number) is expected at the bottom. |
'All Number values as a list': 'Only first Number value': |
Runtime examples with different parameter settings:
Parameters in the Rule list resolver |
Output via Show alert (Popup) |
Comment |
||
Element type |
Option: |
Title (length) |
Message |
|
<No selection> |
|
3 |
[123, 3.57, 0815] |
Without an element type, all entries are considered acceptable. |
|
$null |
123 |
||
Long |
|
1 |
[123] |
Only the first value is explicitly defined as Long. The fact that the string '0815' could be converted to the Long value 815 is irrelevant. |
|
$null |
123 |
||
Double |
|
1 |
[3.57] |
Only the second value is explicitly defined as Long. The fact that the Long value '123' could be converted to the Double value 123.0 is irrelevant. |
|
$null |
3.57 |
||
String |
|
1 |
[0815] |
Only the third value is explicitly defined. A conversion of the numerical values as 'string image' does not take place. |
|
$null |
0815 |
||
Number |
|
2 |
[123, 3.57] |
The parent class Number covers Long and Double, but not String. |
|
$null |
123 |
Typical use case: 'Select' entries via a rule for a characteristic
An association criteria applies exactly when the 'registered company' (Company of session) belongs to more than one group. Membership in a group is formally established by the fact that in the company account the 'Parent companies' (parentCompanies) list field refers to a parent company account with the Company meta type 'Group' (GROUP).
Runtime example:
The company account of 'ZWORX Ltd.' refers to two groups ('XFLOW – Key Accounts' and 'EMEA') as Parent companies in the multiple selection for parent companies.
To clarify the relationships, the label in the service configuration for the Combobox element has been adapted here so that instead of the address data (see parent company 'Vortex Inc.') the Meta type (here: 'Group') of the parent company is displayed if this is not 'Company' (COMPANY).
Configuration:
The screenshot on the right shows the configuration for an association criteria that applies exactly when the Company of session is subordinate to more than one company account with the Company meta type 'Group' (GROUP):
|
|
Typical use case: Select a specific 'Target value' from a list
At the push of a button, an event handler determines and displays via a notification how to reach the user who last changed a specific entity (input value in the data context) by mobile phone.
A search is made in the 'Communication information' of the relevant user for an entry with the Communication type 'Mobile' (MOBILE) and the context '24/7' (text key).
Runtime example:
A particular user (with the identifier 'Querificus') has the following 'Communication infos':
The first entry should be displayed here, since this is relevant according to Type and Context.
Configuration:
The screenshot on the right shows the configuration for an event handler that responds to a Custom action event XF_CALL_LAST_MODIFIER set up as a Triggering event. The Validating rule is limited to a Typprüfung that ensures that an entity is present in the context of the event. This should ensure that the lastModifierId field exists and refers to the ID of a user, if applicable. ►NOTE◄ The possibility that Guest users can change an entity is not to considered here. An Ausführen mit event action is used here as the Action on passed rule, since starting from the lastModifierId from the entity in the context, the relevant user account is set as the alternative reference object. This is made possible by the Input object (type safe) value resolver concatenated with the ID. With the user account as the context, a Show alert (Popup) event action is executed that first accesses the 'username' (username) field in the Title within a Concat strings, which should identify the user in the notification. The Message also uses the Concat strings value resolver to output the relevant phone number in conjunction with a caption. This is obtained via a concatenation of value resolvers, in which the Rule list resolver has the decisive role:
►NOTE◄ In the example, 'error handling' has been omitted for the case that no value is specified for the '24/7 mobile number' in the user account. The Default value resolver could be used to assign information text like 'n/a' or the access method demonstrated in the example could be used to search for communication information with a different specification (e.g. type 'MOBILE' and context 'PRIVATE', see example data above) as a replacement. |
|