Contained in service items

See also: Data service update, Get service items

The Behaviour type Contained in service items determines whether the value present as input data ($input) is included in the current service entries of an element in the group of List elements.

The Behaviour type Contained in service items determines whether the value present as input data ($input) is included in the current service entries of an element in the group of List elements.

images/download/attachments/189431993/image-2024-9-30_12-26-48-version-1-modificationdate-1727692007892-api-v2.png

  • If no element is linked, the service entries of the executing element are evaluated.

  • If an element is linked, the service entries of the linked element are evaluated.

If the element in question belongs to the group of List elements and the value available as input data ($input) is contained in the current service entries, this value is passed to the Actions on 'true'.

If the element in question does not belong to the group of List elements or the value available as input data ($input) is not contained in the current service entries, this value is passed to the Actions on 'false'.

IMPORTANT◄ The Behaviour type only returns the entries currently loaded locally into the element by the data service. If the service configuration settings include paging ('Max. results' per loaded page), search restrictions, etc., these may affect the return value. Stable results can only be expected if a data service is used that does not use paging but always provides all configured entries 'statically' (e.g. based on a dynamic enumeration).

Example

An input form for Orders specifies that in an order's special text attribute ('Selected price list'), a unique identifier is given for the price list to be applied. The selection of the price list is done via a modal portal opened by a Button (see the 'globe' symbol), which will not be described in detail here. Each price list applies only to a specific sales area, which is defined by a whitelist of countries. Corresponding dependencies are regulated in the example Dynamic enum filters for the dynamic enumeration Country in connection with Association criteria. In the context of the order entry, the Association criteria assign a certain dynamic enumeration filter depending on the current value for the text attribute 'Selected price list', which then restricts the selection options for the Country (in the Combobox 'Country code') within the 'Principal Address' according to the selected price list.

Runtime example:

images/download/attachments/189431993/image2020-5-24_14-5-39-version-1-modificationdate-1727691248206-api-v2.png

  • The Selected price list 'BENELUX_2020' selected here applies – as the name suggests – for the countries Belgium (BE), Luxembourg (LU), and the Netherlands (NL).

  • A Principle Address in Belgium was selected, which conforms to the restrictions for the 'Selected price list', as shown in the dropdown on the screenshot.

Due to the dynamic enumeration filter, only one country can be selected for the direct input of a new customer address, which is valid for a previously selected price list. However, the form does not require the selection of the price list to be made before a principal is specified. Nor does it prevent a different price list from being assigned after a principal has been specified. In addition, the Expandable element used for the principal's address not only supports the input of an address, but also the selection of existing address book entries by a dropdown. Therefore it can sometimes occur – as in the following example – that a country appears in the Country code field of a principal's address, for which the Selected price list does not apply:

images/download/attachments/189431993/image2020-5-24_14-12-33-version-1-modificationdate-1727691248214-api-v2.png

  • Here, instead of the address entered in the previous example, a principal in Switzerland was selected from the address book.

  • The restrictions of the price list 'BENELUX_2020' still apply, as shown in the dropdown on the screenshot. However, the dynamic enumeration filter only affects the selectable countries (service entries), but does not prevent the country 'Switzerland' from being assigned as Country code according to the selected address book entry.

Without further provisions, an unsuitable combination of Selected price list and Country code can only be detected if both the Expandable element and the dropdown for the Country code are opened. As shown in the following screenshot, a corresponding message text should appear for the elements Principal Address and Country code when an unsuitable combination is present:

images/download/attachments/189431993/image2020-5-24_14-13-43-version-1-modificationdate-1727691248217-api-v2.png

Configuration:

This section only describes the configuration with regard to the hint texts for which the behaviour type Contained in service items is essential.

images/download/attachments/189431993/image-2024-10-1_9-14-51-version-1-modificationdate-1727766891402-api-v2.png

As a basic mechanism for setting and deleting hint texts, a behaviour 'checkCountryPricelist' is set up for the Combobox element for the country ('Country code') as shown on the left:

  • The behaviour reacts to the Triggering event Changed, i.e. the selection of a country with all Change types. As event data ($input) this triggering event returns the selected value from the dynamic enumeration Country.


  • The Behaviour type Contained in service items should evaluate the currently selectable entries for the executing element (Combobox) and therefore does not use an element link.


  • Below the Actions on 'true', two Set hint are executed, which removes a hint, if applicable, as long as the changed selection matches the available service entries. The parameters Hint and Indicator remain empty for this purpose (not in the screenshot). The actions refer to the executing element ('Country code') and the address selection in the header of the Expandable elements.


  • The same two elements are addressed by the two Set hint actions under Actions on 'false', which however – as shown in the screenshot – define a Hint ('Price list not applicable') and assign the Indicator 'error' (signal 'red' color).

images/download/attachments/189431993/image-2024-10-1_9-16-10-version-1-modificationdate-1727766970784-api-v2.png

The comparison between 'Price list' and 'Country' should not only be executed when changes are made for the 'Country' (see above), but also when the options (or service entries) for the Country change, because a new price list is selected. For this purpose, another behaviour 'countriesUpdated' is created for the same combobox 'Country code' and configured as shown below:

  • The behaviour uses the triggering event Datenservice Update, so it responds to each update of the service records for the executing element. In this example, this takes place with Form data loaded or with 'Context changed'. The latter is relevant because after selecting a price list, the action Invalidate context (not in the screenshot) must be executed to re-evaluate the Association criteria for the dynamic enumeration filters for the Country.


  • As a Behaviour type, Validate element is executed without a linked element to pass the currently selected country as input data ($input) for the actions.


  • Under the Actions on 'true', the behaviour 'checkCountryPricelist' shown above is called by the action Execute behaviour, which is given the currently selected Country as $input.


  • Actions on 'false' are not provided.