A [Select] ... [/Select] tag can be used with one or more nested [Case] tags to select one portion of code to perform.
The parameter of the opening [Select] tag is compared against the parameter of each enclosed [Case] tag in turn. If the parameters match then the code until the next enclosed [Case] statement is executed.
If a [Case] statement has no parameter then it represents the default case and will be executed if no other [Case] statement matches the parameter of the enclosing [Select] ... [/Select] tags. The default [Case] statement should always be last.
If no [Case] statement matches and no default [Case] statement is specified then the [Select] ... [/Select] tags return no output.
Note: The [Select] ... [/Select] tags are equivalent to using [If] and [Else] tags to check a single parameter against a series of values, but are often easier to read.
[Select: 'Select Value']
[Case: 'Case 1 Value']
... Case 1 Code ...
[Case: 'Case 2 Value']
... Case 2 Code ...
[Case]
... Default Code ...
[/Select]
Use the [Select] ... [Case] ... [/Select] tags. The opening [Select] tag accepts a variable that contains a value. The code which is after the first enclosed [Case] statement which matches the variable's value is executed. In the example below a 'color' variable is matched against several color names. If there is no match a default of black or #000000 is used.
[Variable: 'color'='blue']
[Select: $color]
[Case: 'red']
[Output: '#ff0000']
[Case: 'green']
[Output: '#00ff00']
[Case: 'blue']
[Output: '#0000ff']
[Case]
[Output: '#000000']
[/Select]
#0000ff
Tag Link | [Select] ... [/Select] | Category | Conditional |
---|---|---|---|
Type | Container | Data Source | Any |
Support | Preferred | Version | 6.0 |
Output Type | None | Security | Tag |
Implementation | Internal | Sets | Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0 |
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft