Tag Link | [Select] ... | Category | Conditional |
---|---|---|---|
Type | Container | Source Available | No |
Support | Preferred | Version | 6.0 |
Change | Unchanged | Data Source | Any |
Output Type | None | Security | Tag |
Implementation | Internal | Sets | Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0 |
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]
Required Parameters | |
---|---|
Select Value | The value which will be matched against each [Case] tag in turn. |
To select one option based on the value of a variable:
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
Substitution | ||
---|---|---|
|
|
|
Container | ||
|
| |
Process | ||
|
|
|