The list type defines a list of items. Each item has its own numbered position (starting with 0) in the list. Usually a list is obtained through a key-path. However, it is also possible to create a variable l of type list through a variable s of string type as follows:

<cx:let name="s" value="(text0, text1, text2)">

 <cx:let name="l" value="$s.propertyList">
 

 ... $l contains a list type value ...
 

 </cx:let>

</cx:let>

Keys

The following keys are available for any list variable:

Example 1

Print the workhistories of a candidate in chronological order:

<cx:foreach item="wh" list="$activity.toEmployee.workHistories.@sortAscending.startDate">
 Periode: <cx:write value="$wh.startDate" dateformat="%m-%Y"/> tot <cx:write value="$wh.endDate" dateformat="%m-%Y"/>
 Bedrijf: <cx:write value="$wh.employer"/>
 Functie: <cx:write value="$wh.function"/>
</cx:foreach>

Example 2

Print the number of matches of a vacancy:

<cx:write value="$activity.toVacancy.matches.count"/>

Remarks

  • Note that the numbering of a list starts at 0 en consequently ends at n - 1 (n being the number of items in the list).
  • Notably most available keys start with the 'at sign' @. This is characteristic for so called aggregrate keys, these keys work on the list as a whole. Applying 'normal' keys (the ones without the 'at sign' @) would result in the application of the key on every item in the list seperately! The result being a list with the results of this.

@flatten

When applied to a list, all elements in all (arbitrary deep) nested lists become part of the flattened result list.

 Example in plist-notation: (a, (b, c), (d, (e, f), g), h)  =>  (a, b, c, d, e, f, g, h)

Did this answer your question?