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.

images/download/attachments/78256069/image2022-9-1_9-43-51-version-1-modificationdate-1662018231364-api-v2.png

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 images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg 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.

images/download/attachments/78256069/image2022-9-1_9-46-52-version-1-modificationdate-1662018413015-api-v2.png

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 images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg icon initiates the configuration of a rule, which can then be expanded to any complexity by AND and OR conjunctions.

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.

images/download/attachments/78256069/image2022-9-1_9-48-38-version-1-modificationdate-1662018518254-api-v2.png

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:

  • The first value is the static Long value 123.

  • The second value is the static decimal number 3.57.

  • The third value is the static String value 0815.

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.


images/download/attachments/78256069/image2022-9-1_9-50-34-version-1-modificationdate-1662018635032-api-v2.png

The following table lists different parameters for the Rule list resolver, which are based on the diagram shown on the right:

  • An Element type is selected or not.

  • The option Resolve all as list is checked or not.

  • A rule is not configured.

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':
images/download/attachments/78256069/image2022-9-1_9-52-28-version-1-modificationdate-1662018748523-api-v2.png

'Only first Number value':
images/download/attachments/78256069/image2022-9-1_9-53-7-version-1-modificationdate-1662018788034-api-v2.png

Runtime examples with different parameter settings:

Parameters in the Rule list resolver

Output via Show alert (Popup)

Comment

Element type

Option:
'Resolve all as list'

Title (length)
(Number of list entries)

Message
(String[-image])

<No selection>

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/check.svg

3

[123, 3.57, 0815]

Without an element type, all entries are considered acceptable.

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/error.svg

$null

123

Long

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/check.svg

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.

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/error.svg

$null

123

Double

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/check.svg

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.

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/error.svg

$null

3.57

String

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/check.svg

1

[0815]

Only the third value is explicitly defined. A conversion of the numerical values as 'string image' does not take place.

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/error.svg

$null

0815

Number

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/check.svg

2

[123, 3.57]

The parent class Number covers Long and Double, but not String.

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/error.svg

$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).

images/download/attachments/78256069/image2022-9-1_9-57-38-version-1-modificationdate-1662019058718-api-v2.png

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):

  • The primary data for the check here is provided by the Company of session value resolver, namely the company account of the logged-in company.

  • The concatenated Object property value resolver accesses the 'Parent companies' (parentCompanies) field of this company account and returns the list of Long values stored in it, which refer to the IDs of the parent company accounts.

  • The concatenated Rule list resolver filters out from this list the subset of IDs that refer to group company accounts:

    • The Resolve all as list is checked, because for our check criterion the number of all parent groups is decisive.

    • In order for the Entity property rule to check the 'Meta type' (metaType) of a parent company, the complete company account must first be obtained starting from the ID. This is done by the Input object (type safe) value resolver, which is concatenated on the left side with the Object property value resolver for the 'Meta type' field.

    • On the right side of the Equals comparison, the relevant Company meta type 'Group' (GROUP) is statically selected.

  • The actual check criteria is mapped to the outer Entity property rule (per Compare with '> (greater than)'). The number of entries (length field) in the return value of the Rule list resolver is compared with the comparison value 1.

images/download/attachments/78256069/image2022-9-1_9-59-50-version-1-modificationdate-1662019190504-api-v2.png

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.

images/download/attachments/78256069/image2022-9-1_10-0-52-version-1-modificationdate-1662019253147-api-v2.png

images/download/attachments/78256069/image2022-8-31_20-58-34-version-1-modificationdate-1661972314643-api-v2.png

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:

  • First, the Object property value resolver must access the address field of the user account present as an alternative reference object.

  • The concatenated Plural attributes value resolver returns the list of all communication information within that address.

  • The concatenated Rule list resolver searches for the first match in this list (option Resolve all as list is unchecked), for which the two criteria AND-linked in the rule are true:

  • If the address contains communication information that meets both criteria, the concatenated Object property value resolver can then contribute its 'value' (communicationValue) field for the text of the Message.

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.

images/download/attachments/78256069/image2022-9-1_10-3-17-version-1-modificationdate-1662019397999-api-v2.png images/download/attachments/78256069/image2022-9-1_10-4-11-version-1-modificationdate-1662019451504-api-v2.png