The <xmod:select>
gives you a lot of flexibility
in creating your display template. It's similar in
function to Visual Basic's Select/Case statement and Javascript's switch/case
statement. For non-programmer's you can think of it as a multiple choice tag. The tag can be used both within a template and outside of a template. In fact, it can be used to hide or show templates as well as other text and HTML.
<xmod:select
mode="Standard|Inclusive">
<case
comparetype="Numeric|Float|Date|Text|Regex|Boolean|Role"
value="string"
expression="string"
operator="<|>|<>|=|<=|>="
ignorecase="true|false"
culture="LocaleID">
<case>...</case>
...
<else>...</else>
</xmod:select>
<xmod:select>
tag contains one or more
<case>
tags and one optional
<else>
tag. At run-time, XMod Pro will evaluate
each <case>
tag beginning with the first one in
the list. If the tag doesn't evaluate to True, XMod Pro moves to the next
<case>
tag and evaluates it. It continues this
way until it reaches a true <case>
. If none is
found, then nothing will be displayed unless an <else>
tag has been included. If so, it's contents will be displayed. <case>
tag's comparetype
attribute. Using this, you can tell XMod to compare the values as numeric
values, floating point numbers, dates, boolean, text, or to see if the value
matches a regular expression pattern. You can also compare whether the current
user is/isn't in one or more security roles.<case>
tag, you can test for
equality "=", inequality "<>", less-than "<", greater-than ">",
less-than-or-equal "<=", and greater-than-or-equal ">=". Of course, these
operators don't make sense for all types of comparisons. For instance, if you
are doing a regular expression comparison, the value can either match or
not-match the regular expression pattern. So, the only valid operators in that
case are "=" and "<>".<case>
tag's
ignorecase attribute to "true" or "false" to tell
the tag to perform a case-insensitive comparison (true) or a case-sensitive
comparison (false).<case>
tag includes a
culture attribute. This can be set to an LCID (a culture ID) that will
instruct the tag that comparisons should be made using the settings of that
culture. If no culture attribute is set, the tag will
attempt to use the current culture. NOTE: Boolean comparisons do not use a
culture setting. Additionally, regular expressions use the system's culture by
default. You cannot specify a culture for them. However, as with all
comparisons, you can specify "invariant" as the culture to perform a culturally
neutral comparison.Back to top
<xmod:template ...>
...
<itemtemplate>
Your favorite color is:
<xmod:select>
<case comparetype="text" operator="=" value='[[FavColor]]'
expression="blue" ignorecase="true">
<span color="#0000FF">BLUE</span>
</case>
<case comparetype="text" operator="=" value='[[FavColor]]'
expression="red" ignorecase="true">
<span color="#FF0000">RED</span>
</case>
<case comparetype="text" operator="=" value='[[FavColor]]'
expression="green" ignorecase="true">
<span color="#00FF00">GREEN</span>
</case>
<else>
We don't know your favorite color
</else>
</xmod:select><br />
<xmod:select>
<case comparetype="role" operator="=" expression="Administrators">
(This area reserved for Admins only)
</case>
</xmod:select>
</itemtemplate>
...
</xmod:template>