FixedValuesConverter

The FixedValuesConverter offers the possibility to identify and assign entries and values of list elements by means of a key. The key is always the value of a selected entry.
The field of the entry is automatically recognized as the key if it has one of the following names: "data", "@data", "key", "@key", "name", "@name" (priority corresponds to the order).
The default label of an entry/value is automatically the field with one of the following names: "label", "@label", "value", "@value", "data", "@data", "key", "@key" (priority according to the order).

images/download/attachments/44939545/image2020-1-20_15-20-24-version-1-modificationdate-1579530026216-api-v2.png

(1) Specifies the entries per page to enable paging. 0 disables paging completely.

(2) The Key as text option is set by default and specifies whether the key to identify an entry/value is a simple text value. If this option is disabled (as in the image above), a key can also be an object that can be identified by one of its fields (3).

(3) If keys can also consist of objects (option 2 not set), a data field path can be defined here relative to the key object, which points to a uniquely identifiable value.

Examples with 'Static values service'

To create static values the 'Static values service' is used.

Example with key as text (default: 'Key as text' option enabled)

The entries of a combobox are configured in the category 'Entries and service' as follows:

images/download/attachments/44939545/image2020-1-20_15-34-44-version-1-modificationdate-1579530886608-api-v2.png

The "key'" field is used to represent an entry (1), which in this case is a sequential number as text. This key is used to identify the entries and is written as a value in the form data.
The "label" field is used as the default label. The following table shows the configured combobox in action:

Combobox

Value in the form data

images/download/attachments/44939545/image2020-1-20_15-42-58-version-1-modificationdate-1579531380977-api-v2.png

"2"

Example with objects as keys (option 'Key as text' deactivated)

A Lobster_data profile named 'GetArticleParts' returns a list of entries in the following form as JSON using the 'Data from Profile' service.:

Profile return (JSON)
[
{
"key": {
"identifier": "WQL",
"value": "13",
"unit": "mm"
},
"label": "13 mm WQL"
},
{
"key": {
"identifier": "ZFM",
"value": "5",
"unit": "pc"
},
"label": "5 pc ZFM"
},
{
"key": {
"identifier": "OLK",
"value": "40",
"unit": "mm"
},
"label": "50 mm OLK"
},
{
"key": {
"identifier": "MFF",
"value": "20",
"unit": "mm"
},
"label": "20 mm MFF"
}
]

The entries in the 'Entries and service' category of the combobox have been configured as follows.

images/download/attachments/44939545/image2020-1-20_15-56-14-version-1-modificationdate-1579532176110-api-v2.png

The entry field 'identifier' is used for the identification of the entries and must therefore also be unique.
The advantage of this is that a tuple with an 'identifier' field (or directly the value of the identifier) can be set as the value of the combobox and then the correct entry is selected and its key is transferred to the form data.

The following table shows the configured combobox in action:

Combobox

Value in the form data

images/download/attachments/44939545/image2020-1-20_15-52-30-version-1-modificationdate-1579531952748-api-v2.png

{
"identifier": "OLK",
"value": "40",
"unit": "mm"
}

The option '20 mm MFF' (for example) could now be selected in two different ways with the action 'Set value':

1. 'MFF' (The direct value of the 'identifier' field).

2. {'identifier': 'MFF' } as tuple/object.