Chapter 5 Building Dynamic Diagrams


Example: Reading and writing variables

Variables hold temporary values that can be passed between activities. You can create and access variables using the Write Variable and Read Variables action types

Steps To create a variable:

  1. Open the property sheet of an activity and click the Action tab.
  2. Select an action type of Write Variable, and then click the Create tool to the right of the variable field to create a new variable and open its property sheet.
  3. Specify the name and other properties of the variable and click OK to return to the activity property sheet.

Steps To write to an existing variable:

  1. Open the property sheet of an activity and click the Action tab.
  2. Select an action type of Write Variable, and then click the Select Object tool to the right of the variable field to choose the variable.
  3. Select the appropriate variable in the list and click OK to return to the activity property sheet.

Steps To read from a variable:

  1. Open the property sheet of an activity and click the Action tab.
  2. Select an action type of Read Variable, and then click the Create or Select Object tool to the right of the variable field to create a new variable or select an existing one.

Variable properties

Variables can have the following properties:

Property Description
Name Specifies the name of the item, which should be clear and meaningful, and should convey the item's purpose to non-technical users.
Code Specifies the technical name of the object, which is used for generating code or scripts.
Comment Descriptive comment for the object.
Stereotype Extends the semantics of the object beyond the core UML definition.
Data type Specifies the data type of the variable. You can choose a standard data type or specify a classifier. You can use the tools to the right of the list to create a classifier, browse the available classifiers or view the properties of the currently selected classifier.
Multiplicity Specifies the number of instances of the variable. If the multiplicity is a range of values, it means that the number of variables can vary at run time.

You can choose between:

  • * – none to unlimited
  • 0..* – zero to unlimited
  • 0..1 – zero or one
  • 1..* – one to unlimited
  • 1..1 – exactly one

 


Copyright (C) 2008. Sybase Inc. All rights reserved.