Skip to main content
CxScript Elements cx:if
Updated over 6 years ago

The content of the cx:if element is being evaluated depeninding the condition, like: 

<cx:if condition="activity.toEmployee.age < 18">

 ... This candidate is a minor ...

</cx:if>

 

<cx:if not="1" condition="activity.toEmployee.lastname like 'peter*'">

 The last name of this candidate does not start with 'peter'.

</cx:if>

 

Attribuut

If - Else

The if-then-else construction (a well known programming construct) is obtained by using a cx:if element followed by a cx:elseelement, as follows:

<cx:if condition="x >= 0">

 ... x is greater than or equal to 0 ...

</cx:if>

<cx:else>

 ... x is not greater than or equal to 0 ...

</cx:else>

The cx:else always belongs to the last preceding cx:if.

Remarks

  • Note that in a condition variable names are not preceded by the dollar sign $.

  • The most correct value for the not attribute is $YES. However, this feels strange.
    Therefor use the following notation: not="". The result is the same.

  • Within a cx:if or cx:else element other cx:if of cx:else elements can be nested.

Did this answer your question?