If you want to list all employees of a company ordered by name, you can sort the list later with the sort function.
The fr_comps Variable ist filled form a content select.
$CMS_FOR(company , fr_comps)$<ul>
<li>$CMS_VALUE(company.name)$</li><ul>
$CMS_FOR(employee , company.employeeList.sort(x -> x.surname))$
<li>$CMS_VALUE(employee.surname)$, $CMS_VALUE(employee.firstname)$</li>
$CMS_END_FOR$</ul>
</ul>
$CMS_END_FOR$
<CMS_FUNCTION name="contentSelect" resultname="fr_comps">
<CMS_PARAM name="schema" value="knowledgebase" />
<QUERY entityType="company">
</QUERY>
</CMS_FUNCTION>
It is also possible to filter the list with the filter function.
<ul>
$CMS_FOR(company , fr_comps)$
$CMS_FOR(employee , company.employeeList.filter(x -> x.recruitmentdate > st_recruitmentdate))$
<li>$CMS_VALUE(employee.surname)$, $CMS_VALUE(employee.firstname)$ ($CMS_VALUE(company.name)$)</li>
$CMS_END_FOR$</ul>
$CMS_END_FOR$
</ul>
The variable st_recruitmentdate is set by a formular (CMS_INPUT_DATE) where definend in a section template.
These feature were previously known as the lambda function, the old syntax (.sort(lambda(x : x.surname))) is marked as deprecated with the 4.1 release.