Previous Topic: Restart in Batch ProceduresNext Topic: Design Designer-Added Procedures


Design for Ease of Use

Depending on the characteristics of the implementation, you may supplement the action diagram significantly. Any logic is required to provide a reasonable implementation of elementary processes is permissible.

Suppose that while considering the implementation of Maintain Customer and the requirements of the user community, you conclude the following points:

The following sample code presents one possible solution to these requirements.

Procedure Action Diagram for Maintain Customer (version 2)

MAINTAIN_CUSTOMER_VERSION_2
     IMPORTS:        Entity View hidden_import_customer
                     Entity View import_customer
     EXPORTS:        Entity View hidden_export_customer
                     Entity View export_customer
     LOCALS:         Entity View temporary customer
     ENTITY ACTIONS: Entity View customer
EXIT STATE IS requested_operation_complete

CASE OF COMMAND
CASE display
     READ customer
          WHERE DESIRED customer number IS EQUAL TO import customer number
     WHEN successful
     MOVE customer TO export customer
     SET hidden export customer number TO customer number
     WHEN not found
     EXIT STATE IS customer_not_found

CASE delete
     IF hidden_import customer number IS EQUAL TO import customer number
     USE delete_customer
          WHICH IMPORTS: Entity View import customer
          WHICH EXPORTS: Entity View export customer
     ELSE
     EXIT STATE IS read_required_before_delete
     COMMAND IS display

CASE add
     USE add_new_customer
          WHICH IMPORTS: Entity View import customer
          WHICH EXPORTS: Entity View export customer
               IF EXIT STATE IS EQUAL TO requested_operation_complete
               MOVE temporary customer TO export customer
               SET hidden_export customer number TO customer number
               MAKE export customer name “ERROR”
     ELSEIF EXIT STATE IS EQUAL TO customer_already_exists
     OTHERWISE
     EXIT STATE IS invalid_command

This procedure step includes several new data views:

This procedure step includes a new CASE option to the CASE OF COMMAND action.

If the command is Display, the requested customer is read and displayed. Note lines 10 through 19.

A move action is required to populate the export view from the entity action view. See note line 15.

If the read statement is successful, the Customer Number is saved in the hidden field Hidden Export Customer Number.

In the Add case, modeled in lines 30 through 40, the user may delete the customer just added. The newly added customer's number should be saved as a hidden field just as in the Display case. See line 16.

To allow the user to continue with the next transaction, it is useful to clear the display of the customer data just added, so in line 35 the local view Temporary Customer (defined in line 6, containing attributes that remain unpopulated) is moved to Export Customer.

More information:

Designing Screens