This article is not up to date and it has been substitute with new up to date content.

Please look the new up to date content.

How to use the Switch Unit

by Laura Cigardi
751 views Published on Oct 24, 2011
Applies to: All versions
Table of contents

The Switch Unit implements the behavior of classical instruction SWITCH-CASE of high level programming languages: given an input variable and a set of CASE values respectively associated with a set of instruction sequences, the actual value of the input variable univocally determines the instruction sequence to be executed. In the IFML model, the switch operation defines a set of alternative navigational paths, and the path to be followed is chosen according to the value of the input parameter received by the switch operation. To model the set of alternative paths the unit has different outgoing OK links. Each OK link has an associated CODE that is one of the Switch Unit CASE values.

A CASE value represents one of the possible values of interest of the Switch Unit input parameter. You can define different CASE values for the unit. To add a CASE value you have to:

  1. select the unit
  2. click on the button next to the Case field in the Properties View
  3. click on the Add.. button
  4. type the CASE value in the opening dialog
  5. click on the OK button

From the Switch Unit you can draw many OK links. You have to set for each OK link, the corresponding CODE. The CODE is one of the CASE values of the unit and represents the specific case in which the specific OK link has to be followed after the unit computation. You can have only one link without a CODE associated. This means that it is the default OK link the unit must follow if the input parameter is not equal to anyone of the specified CASE values. To add a CODE to an OK link you have to:

  1. draw the OK link
  2. choose a CASE value in the CODE field in the Properties View

The following figure shows a sample Web model using the Switch Unit with many outgoing OK link, with a default one.

 
 

This article is not up to date and it has been substitute with new up to date content.

Please look the new up to date content.

Related Learning Objects