PAK Commands – Multiple Choice
2. Examples
Due to simplicity, the descriptiveText
input parameter will be left empty for the examples. By default, it is set to „Please select your choice(s) to continue.“.
All example images use the Human Task representation of the Workflow Executor. |
The choices
parameter has to be provided.
|
|
In the first example we provided [1,2,3,4]
as choices
. By default, the user is now able to select one or more of the displayed items. The result will be written as a JSON array, in this case [1,3]
under the key selectedChoices
.
We can also restrict that the user must select all items or only a single item. This can be achieved by setting the selectionMode
parameter to "single"
(default) or "all"
respectively.
This representation works well for simple input lists, however sometimes you might have an input like.
[
{
"firstName": "Max",
"lastName": "Mustermann",
"age": 35
},
{
"firstName": "John",
"lastName": "Doe",
"age": 23
},
{
"firstName": "Peter",
"lastName": "Smith",
"age": 28
}
]
which would be shown as follows.
This might be hard to read for your user. Using a simplified interpolation, we can make use of the labelMapping
parameter to tackle this issue. So for instance we could map our input to §{lastName}, §{firstName}
.
In order to not clash with PAKs interpolation, we use § to indicate a label mapping
|
You can only map one level deep into the JSON |
|
|
In the third example we mapped our input for better readability. When we for example select John Doe and Peter Smith, our selected choices will be written as [{"firstName":"Max","lastName":"Mustermann","age":35},{"firstName":"Peter","lastName":"Smith","age":28}]
. However, the selectedLabels
are also written as ["Mustermann, Max","Smith, Peter"]
in this instance.
If some choices should be preselected, the preselectedChoices
input field takes all choices that should be preselected.
If the selection mode is set to single, only the first item of the list is preselected |
In this Example the list [1,2,3,4]
as choices
are entered. This time however ["2","4"]
is also entered in preselectedChoices
. This requires the labels to be entered in the field.