Skip to content

WriteVariable Action

Warning

This is only available in Enterprie Architect for Magic Draw see: Add Variable Value

With a write variable action you can assign values you provide via object flows, to a code snippet of your choice. You can add them to your diagram by clicking on Action in the toolbox, and clicking on the activity diagram afterwards while holding the CTRL key. There you can select Write Variable which will add a write variable action to your diagram.

WriteVariable

Note that the value pin isn't shown by default. To get the value pin, right-click on the value specification and select Structural Elements... where you can select the value pin to be shown.

Flow Direction

Info

Object flows do not need to run in the same direction as the control flow.

In this example, we use a value specification and its result to write a new variable int a by forwarding the controlflow to the next element and also by creating an object flow from result pin to the value pin.

WriteVariable WriteVariable

Both behaviors are allowed and valid.