| Command group | Flag affected | Reversible | Execute on client | Platform(s) |
| Constructs | NO | NO | YES | All |
This command initiates a Switch method construct. You use a Switch statement to select a course of action from a set of options based on the value of a variable, expression or calculation. It is similar to an IfElse If construct although the performance of a Switch construct tends to be faster.
The first line of the construction contains the Switch command. This defines the variable, expression or calculation on which the choice of action will depend. Following the Switch command, the Case commands provide values which, if matched with the expression supplied in the Switch line, cause the methods between case lines to be executed.
You can nest multiple Switch statements, and embed other conditional statements such as IfElse constructs.
# next button - only allow user to proceed to next page of a paged pane if the required information has been entered
CalculatelPageas$cwind.$objs.PagedPane.$currentpage
SwitchlPageCase1Iflen(iSerialNumber)=0CalculatelErrorMsgas'Please enter a serial number'End IfCase2Iflen(iUserName)=0CalculatelErrorMsgas'Please enter your username'End IfCase3IfiAgreeFlag=CalculatelErrorMsgas'You may not proceed until you agree to the license agreement'End If
End Switch
Iflen(lErrorMsg)OK message{[lErrorMsg]}
ElseDo$cwind.$objs.PagedPane.$currentpage.$assign(lPage+1)## go to next page
End If