- PDF
Lists
- PDF
The navigation point Lists contains elements that enable the creation and editing of objects with several articles (including products).
list: The operator is used to create a data collection. The elements in the list can contain any values (e.g. numbers / text / answers / questions / expressions).
index: Allows you to obtain the index of a specific element in the list. The numbering of the elements in the list starts with '0'.
length: Is used together with the list element and indicates the number of elements in the list.
append: Is used to combine several lists with each other.
⚠️ Note on the configuration of the following examples
The following examples show exemplary rules. In order to display the result of a rule (i.e. the content of a created field) on the result page, the field must always also be configured via the Result Page workbench navigation item. For the sake of clarity, we do not show this step in the examples. Please refer to the related article.
Example 1: Using list to check the selection of specific answers
In the example, the system checks whether at least one of the following answers has been selected: 1 week / 2 weeks / 4 weeks / 8 weeks.
The logic is as follows:
The values of the answers are added to the list
isAnySeleceted is a variable that assumes the value true if one of the specified answers has been selected. Otherwise it assumes the value "false".
A for each loop is used to run through all the values in the list. Within this loop, an 'if' condition is applied to each item in the list (one at a time) to check whether the answer has been selected from the list.
If at least one answer has been selected from the list, the variable isAnySeleceted receives the value true and can be used later within the "if" condition (if isAnySeleceted then do ...).
In principle, this logic could also be configured without the lists element. However, this would make the structure much more complex:
Example 2: Use of index
Exemplary configuration:
In this example, we have a list with [1, 2, 3] elements. Each element has its own index, starting at 0:
Here we want to select an element with the index 0 from the list [1, 2, 3]. The table above shows an element and the corresponding index for each element.
So if we select element 0 of the list, we get the value "1" (the first value of the list).
Example 3: Use of length
Exemplary configuration in combination with the list element:
In the example, 3 is played, as there are 3 elements in the list '1,2,3'.
Example 4: Using append
Exemplary configuration in combination with the list element:
In this example, two lists are combined. The result is a list with the five elements [A, B, C, D, E].