All attributes of one type
Resolver – Abstract
Purpose: In the context of a reference object (entity type must be attribute owner), returns the single values of all attributes of a given type as a list.
The All attributes of one type value resolver provides access to all attributes of an entity that belong to a specific attribute type. It expects an entity as a reference object, which is an 'attribute owner' according to the type (see Attribute (Resolvers)). The return value is a list of single values of the specified attribute type, which can also be empty. For specific read and write accesses (see 'Examples'), the Resolvers specific to lists (e.g. List item, Rule list resolver) and Event actions (e.g. For each loop, Modify list) can be used.
As an Attribute, exactly one attribute type must be selected from one of the following categories:
Category |
Example for 'Attribute' (Attribute type) |
Return value of the value resolver |
Singular attribute |
'Additions GLS' in Company accounts |
A list that contains exactly one singular 'Additions GLS' attribute or is empty. |
Plural attributes |
'Communication infos' in Addresses |
A list containing all 'Communication infos' (attributes) of the address or is empty. |
Typed attributes |
'Text attribute' (e.g. in Shipments) |
A list containing all 'Text attributes' (of all subtypes) of the business transaction object or is empty. |
Other attributes |
'Product ID'/'Price attribute' for Products |
A list containing either all 'Price attributes', 'Product ID' attributes for the product, or is empty. |
Configuration
The All attributes of one type value resolver expects a reference object whose data model is considered the 'Attribute owner' (see Attribute (Resolvers)).
The Attribute parameter provides a static single selection for the attribute type whose value list is accessed. As long as the context of the configuration does not refer to a specific entity type, all attribute types that the system supports appear for selection. The Combobox element offers a search function that takes into account the internal class names of the attributes as well as associated localizations from the localization. |
|
If, on the other hand, the context of the configuration refers to a specific entity type for the reference object, then only the multiple attribute types explicitly implemented in the relevant data model appear for selection. On the right, a Check type (not in the image) refers to a Routing table entry, so that only the (typed) attributes intended for this entity are selectable. |
|
If no Attribute type is selected, then the return value of the value resolver is always 'no value' (null).
If a selected Attribute type is not supported by the type of the reference object present at runtime, the return value is also 'no value' (null).
If the reference object present at runtime supports the selected Attribute type, but no relevant data is contained in the reference object, an empty list is returned.
Examples
Example of 'write access'
When saving a product catalog entry in a specific catalog, the data of the price attributes contained in the product should be automatically 'revised':
If the 'Tax rate' (taxRate)has not yet been filled for a price attribute, it can be determined in the dynamic enumeration Tax rate whether a 'Default tax rate' has been defined for the 'Country' (country).
A 'Default tax rate' should be recognizable by arbitrary convention by the fact that the internal name for the value in question (in the dynamic enumeration Tax rate) is the text concatenation of a country code (see Country) with the suffix '_default'.
If a 'Default tax rate' exists for the 'Country' (country), it should be assigned to the 'Tax rate' (taxRate) field.
Runtime example
Values entered in price attributes (before saving) |
Automatic revision (after saving) |
|
|
The input form allows the Net value for each price attribute to be entered and a selection for the Tax rate (see Tax rate).
The element for the Gross value is configured here as a calculation field (see Calculation field) with an expression according to the scheme $product($el(<netValue>),$taxRate($el(<taxRate>))) (see product (Multiplication), taxRate (Tax rate)).
►NOTE◄ The Gross value element is also disabled so that it cannot be modified, and its data field is set to 'Skip' so that the calculated value is not stored in the attribute field (grossValue).After saving (right), the Tax rate (taxRate) field was filled just for the countries 'Germany' and 'Switzerland'. It appears there is no default Tax rate (with the internal name VAT_default) for 'Austria' (yet).
Configuration:
An event handler that reacts to the events 'Create' and 'Update', i.e. 'Saving' an entity (see Common action event) is configured as shown on the right:
|
|
The Resolver for entities, which defines the basis for iteration within the loop, is configured as a concatenation of value resolvers as shown on the right:
The Rule list resolver returns a list of all price attributes of the product for which a default tax rate can be assigned. The assignment is only performed for these within the loop (see above). ►NOTE◄ Products are Referenced objects, so changes to attributes of a product referenced in a product catalog entry do not change the properties of that product if it has already been saved. Rather, when saving, the system checks whether the changed feature combination corresponds to an existing product. Otherwise, this product will be automatically recreated. Then the reference in the product catalog entry is changed to the existing or newly created product. Existing references, e.g. in items of business objects or other product catalogs, continue to refer to the original product. |
|
Example of 'Read access'
In an overview for Users, a click on a custom ribbon button ‘Flags’ (see Ribbon macros) should open a notification with a list of all ‘flags’ that are set for a selected user.
Specifically, all indicator attributes that are assigned to the user's address and for which the indicator value is $true are evaluated.
The localised name for the Flag type from the respective attribute should then appear in the list.
Runtime example:
Configuration:
A Custom action event ‘Show flags (user)’ must be created and the corresponding ribbon macro added and assigned in the context of the ‘User overview’. Details on this are not provided here.
An event handling that uses the ‘Display flags (user)’ event as the Triggering event is configured as shown on the right:
|
|
The subset of all flag attributes that are ‘set’ for the user is therefore passed on to the concatenated value resolvers below. This list is empty if no flags are set.
|
|