LassoScript Utility
Basics Browse Detail

[Case]

Tag Link [Case] Category Conditional
Type Process 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

Description

The [Case] tag is used to define one possible outcome from [Select] ... [/Select] tags. If the value specified in the opening [Select] tag matches the value for the [Case] tag then the code until the next [Case] tag is executed.

If a [Case] tag is specified without a value then it is the default case and will be executed only if no other [Case] in the current [Select] ... [/Select] tags is matched.

Syntax

[Select: 'Select Value']
[Case: 'Case 1 Value']
... Case 1 Code ...
[Case: 'Case 2 Value']
... Case 2 Code ...
[Case]
... Default Code ...
[/Select]

Parameters

Optional Parameters
Case Value The value of the current case. If no value is specified then the case represents the default case.

Examples

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'='green']
[Select: $color]
[Case: 'red']
[Output: '#ff0000']
[Case: 'green']
[Output: '#00ff00']
[Case: 'blue']
[Output: '#0000ff']
[Case]
[Output: '#000000']
[/Select]

#00ff00

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.

#0000ff