Previous Topic: Perform View MaintenanceNext Topic: Set Exit States


Finish Adding Action Diagram Statements

The Add Statement dialog now gives us the choice of selecting the golfer Entity Action view that we added to the diagram.

Note: In the background the ADD GOLFER – Action Diagram has an ellipsis (…) next to ENTITY ACTIONS: indicating that there is now a contracted view (of GOLFER) there.

Finish Adding Action Diagram Statements

Follow these steps:

  1. In the Add Statement dialog, select golfer from the bottom panel.

    Note: A golfer is added to the statement we are creating in the upper panel and we are presented with new choices in the bottom panel. This will continue until we finish building the statement and then add it to the action diagram. If we make the wrong choice along the way, we can select the Undo push button to back up one or more selections.

    In many cases, the Toolset tries to help you out by automating some tasks and selections. For example, when we create an occurrence of golfer, we have to set its first name, last name, and so on, to a specific value. Usually these values will be passed to us through the import views. We can add the Set statements manually, much like we are adding this Create statement, or we can allow the Toolset to add them for us. Sometimes it is easier to add them manually; sometimes it is easier to let the Toolset add them. In this case, it is going to be easier to allow the Toolset to add them for us, since all of our attribute values will be set from the import view, which we have yet to define.

  2. Select Set all attributes (no associations) from the choices in the bottom panel. If we wanted to add the attributes manually, we would have selected Add no SET or ASSOCIATE statements. If we only wanted mandatory attributes to be set or had relationships to other entity types to be associated, we would have selected one of the other options.

    The Toolset now knows that we want it to set all of the attributes for us, but it does not know from which view to get the values to set the attributes. Normally, the bottom panel would show us a listing of the transient views in our diagram to choose from, but since we have no other views defined, there is nothing to list. However, we know that we want the attributes set from an import view, and we can let the Toolset create one for us.

    Select <New IMPORT View> from the bottom panel.

  3. If your Add Statement dialog looks like the one in the following example, select the Add push button to add the statement to the action diagram. If it looks different, select the Undo button (repeatedly if necessary) and try to correct it. If necessary, you can add the statement to the diagram, delete it, delete any views created for you, and start again.

    Finish Adding Action Diagram Statements

  4. Your ADD GOLFER action diagram should look like the following diagram. The order in which the attributes appear in each view is not important, as long as each view contains the attributes indicated. To expand the views as shown, from the Menu Bar select View, and then select Expand All Views from the drop-down menu. Alternatively, you can select each contracted view separately, and then select the Expand icon on the Tool Bar.

    Finish Adding Action Diagram Statements

    There are only a few things left to do to complete the ADD GOLFER action diagram.

  5. According to the data model, the attributes password, first name, last name, and user ID are all mandatory, while handicap index and email address are optional. Since they are optional, they should not be marked as required (mandatory) in the import views of this process. Furthermore, the golfer will not provide us with their handicap index; we are going to calculate it for them based on the scoring records they enter. So it should not even be an import to this process, and we should not be setting it in the create statement. Therefore, we need to remove the views and the set statement associated with the handicap index from the action diagram. To delete any views, we must first remove the references to them in the action diagram statements.

    Highlight the entire statement SET handicap index TO import golfer handicap index by selecting, the word SET in the statement. Select the Delete icon from the Tool Bar and select the Yes push button when prompted for confirmation.

  6. Select handicap index in both the import view and the entity action view by selecting it first in one view and then, while holding the Ctrl key down, selecting it in the other view. Your action diagram should look like the following example:

    Finish Adding Action Diagram Statements

  7. From the Main Menu select Edit, and then select Delete View(s)… toward the bottom of the drop-down menu. Select Yes when prompted for confirmation.
  8. Double-click mandatory next to email address in the import view and change the properties drop-down menu to Sometimes. Select the OK push button. This will change it to optional in the action diagram.

    Finish Adding Action Diagram Statements