Most generic directive for using conditional sections is “if”. For marking end of the conditional section use “/if”. Remember, this is paired directive, consisting of two containers and section between them.
If we want to print conditional text if the the partner is Customer, the directive would look:
<if test="objects.customer"> This text is being printed when partner is a customer. </if>
Here we can see paired directive, so you have to place two separate containers, one for the opening part of directive (if test=”objects.customer”), the other for closing part (/if). All that is between them will be placed on final document, when check-box named “Customer” on Partner object is marked.
Similar to if-elif-else conditional section like it is in most programming languages, there is slightly complicated structure used instead. Consisting of “choose” paired directive, at least one “when” and one “otherwise” paired directives, it is possible to create switch like constructions.
Following example shows how to create such conditional section:
<choose> <when test="objects.customer"> This text is being printed when partner is a customer. </when> <when test="objects.supplier"> This text is being printed when partner is a supplier. </when> <otherwise> This text is being printed in all the other occasions. </otherwise> </choose>