You can use an Alf expression the guard for an Activity Edge (Object Flow or Control Flow) in an Activity. However, in this case, it is generally easier to create the Expression directly into the Specification window for the Activity Edge, and then subsequently edit it using the Alf editor.
To create an Alf guard Expression
- Open the Specification window for the Activity Edge on an Activity diagram.
Click on the Guard property and then click on the
button at the left of the field.
In the Edit Guard window, select Alf for Language (you may need to scroll up in the menu) and enter the Alf code for the expression into the Body field.

- Click OK to close the Edit Guard window.
- Close the Specification window.
To edit an Alf guard Expression using the Alf editor
- Select the Activity Edge and open the Alf editor window (select Windows > Alf), if it isn't already open.
- Edit the guard Expression and click Save to save and compile it.

You also can edit the Alf code in the Edit Guard window just as in the Alf editor window. However, instead of Save and Revert buttons, this window has OK and Cancel buttons, either of which will close it. If you press OK, then the Alf text is saved, and, if it has no errors, compiled. If you press Cancel, the Alf text is not saved.
To edit an Alf guard Expression in the Edit Guard window
- Open the Specification window for the Activity Edge on an Activity Diagram.
- Click on the Guard property and then click on the
button at the left of the field Edit the Alf expression as above.