For each transition, you can write code for the transition condition and the activities associated with the transition.

The code area for transitions is always below the code area for the state from which the transitions are leading. Activate a state in the diagram pane or Explorer to display its code in code view.

Figure 72. Code View for Two Transitions Leading Away From the Same State

For each transition that leads away from the enabled state, a separate tab is created. Each of these tabs contains two code sections:

section condition
    // condition
endsection
Between the section condition and the endsection keywords, write the code for the condition that must be met to execute the transition.
section action
    // code for die activities
endsection
Between the section action and the endsection keywords, write the code for activities to execute with the transition.
Note
  • You can leave both code sections blank.
  • As a condition, you can only enter a Boolean expression that returns the result true or false.
  • Without the condition the state is left immediately after the 1 cycle.

Example

section condition
  x == 1and y == 0  // condition
endsection

section action
  x = 0// resetting x
  sys:logInfo(sys:ui,"Transition 1 executed") // output in logfile
endsection