Switch tag
Overview
Use the switch tag to conditionally include part of a report depending on which condition is true. The switch tag contains case tags, which each have a seperate condition.
When a switch tag is found in a template, our reporting products find the first case tag that has a "true" condition and output everything between that case tag and the next case tag (or if it is the last case tag, everything to the end case tag).
Be sure to insert the start and end switch tags!
Attributes
The switch itself does not contain any attributes.
Examples
Note that while the following examples only contain two case statements, we have no limitations in the number of case tags that can be used.
Example 1 - First case is true
Given a template with the following tags,
<switch>
<case select='=1=1' />
First case is true!
<case select='=1=2' />
Second case is true!
</switch>
Example Output 1
First case is true!
Example 2 - Second case is true
<switch>
<case select='=1=2' />
First case is true!
<case select='=1=1' />
Second case is true!
</switch>
Example Output 2
Second case is true!
Example 3 - Neither case is true
<switch>
<case select='=1=2'/>
First case is true!
<case select='=1=3'/>
Second case is true!
</switch>
Example Output 3
(No output)
Example 4 - Both cases are true
<switch>
<case select='=1=1'/>
First case is true!
<case select='=2=2'/>
Second case is also true!
</switch>
Example Output 4 - Note only the first true condition is output
First case is true!