AMT Help Files
homeLION Language ReferenceCommandsCASE

CASE

Syntax

STARTCASE <Item>

  CASE <Value list>
       <Code lines>
  [CASE <Value list>
        <Code lines>
  [CASE <Value list>
        <Code lines>
      ...
      ...]]

  [ELSE 
        <Code lines>]

ENDCASE

Description

Executes or skips implemented <Code lines>, depending on whether or not the specified <Item> matches with a value in a specific <Value list>.
If the <Item> is not found in a <Value list>, then the further code is skipped until the next CASE..., ELSE or ENDCASE is encountered. If the <Item> is found in a <Value list>, then the code directly below the concerned CASE condition is executed until the next CASE.., ELSE or ENDCASE is encountered. The next CASE and ELSE will then behave like an ENDCASE, which always ends the instruction. It is not allowed to include an <Item> in multiple value lists, in that case a Duplicate case label error is given while validating.

If a system enumeration is used in CASE, all other CASE values must also be enums of the same type. STARTCASE must be used in conjunction, using a system enumeration compatible dynamic property. Also see pages STARTCASE and System Enums.

Diagram

Returned value type

None

Parameters

Parameter Description
<Item> Expression of which the result is compared against the values in the value lists.
<Value list> Specification of values that are separated by a space. The is compared with . Possible values are:
  • Strings, written between single quotes. E.g. 'YES' or '*'.
  • Numeric values. E.g. 5.
  • A range of values. A range is indicated with two dots between two values. E.g. 'A'..'F' or 4..7.
  • Boolean
<Code lines>
Case dependant code that may or may not be executed. If a case condition is met, the applicable code will be executed. If no conditions are met the code following ELSE is executed.

Remarks

STARTCASE may be abbreviated to SC, ENDCASE to EC and CASE to CS

Examples

startcase lowercase (ga-100)
case 'inq' 'search'
  isInq  := true
  xmaint := 'INQ'
case 'chg'
  isChg  := true
  xmaint := 'CHG'
case 'del'
  isDel  := true
  xmaint := 'DEL'
case 'add'
  isAdd  := true
  xmaint := 'ADD'
else
  smex ('Unknown action!')
endcase
sc inputvalue
cs 1
  gotoform ('startform')
cs 2 3 4
  gotoform ('otherform')
cs 5..8
  gotoform ('lastform')
ec
sc true
cs lb-address
  sme ('address found')
cs lb-phone
  sme ('phone found')
ec
startcase label1.ALIGNMENT
case SE-TEXTALIGNMENT.LEFTJUSTIFY
  sme ('left')
case SE-TEXTALIGNMENT.CENTERJUSTIFY
  sme ('center')
case SE-TEXTALIGNMENT.RIGHTJUSTIFY
  sme ('right')
endcase

Return to

Commands

Contents

 Go to top