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

  1. The if (closed in line 13) makes sure that this block only shows if there is 1 or more educations in the candidate file.
  2. The list of educations, closed in line 12
  3. Index counts from 0, with intSucc we add one.
  4. 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.../>
  5. Second level of the education, only shows when there is no level 3.
  6. Third level of the education
  7. Training institutions.
  8. Date, the dateformat="%Y" only shows the year.
  9. "0" means no degree
  10. "1" means gratuated
  11. "2" means education aborted
  12. Close the foreach
  13. 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
Did this answer your question?