As example for a complicated piece of CxScript here the educations of a candidate. The line numbers are only for reference.
01: <cx:if condition="activity.toEmployee.educations.count >0"> Opleidingen
02: <cx:foreach list="$activity.toEmployee.educations.@sortDescending.startDate" item="edu" index="i">
03: opleiding <cx:write value="$i.intSucc"/>
04: * <cx:if condition="edu.showLevel1 > 0"><cx:write value="$edu.toLevel1Education1.value"/></cx>,
05: * <cx:if condition="edu.showLevel2 > 0"><cx:write value="$edu.toLevel1Education2.value"/></cx>
06: * <cx:if condition="edu.showLevel3 > 0"><cx:write value="$edu.toLevel1Education3.value"/></cx>
07: instelling: <cx:write value="$edu.institute"/>
08: van-tot: <cx:write value="$edu.startDate" dateformat="%Y"/>–<cx:write value="$edu.endDate" dateformat="%Y"/>
09: status: <cx:if condition="edu.hasCertificate = 0">studerend</cx>
10: <cx:if condition="edu.hasCertificate = 1">diploma</cx>
11: <cx:if condition="edu.hasCertificate = 2">afgebroken</cx>
12: </cx:foreach>
13: </cx:if>
Remarks
The if (closed in line 13) makes sure that this block only shows if there is 1 or more educations in the candidate file.
The list of educations, closed in line 12
Index counts from 0, with intSucc we add one.
Highest level of education. Only shown when it needs to. Do you want to show all the levels of education, replace the <if...> </if> for <cx:write.../>
Second level of the education, only shows when there is no level 3.
Third level of the education
Training institutions.
Date, the dateformat="%Y" only shows the year.
"0" means no degree
"1" means gratuated
"2" means education aborted
Close the foreach
Close the if
Tips
In the Template it looks better to put the lines 4, 5, 6 on one line, just as line 9, 10, 11