Assigning Actions to Menu Options

Once you define a menu option, you can assign an action to it. An action is a command that performs a specific function. For example, the action for the menu option "View customer information" selects customer information from a table and displays it.

You can assign any number of actions (discussed below) to a single menu option. For example, you might want a user to be able to enter data in a table, view the data that was entered, correct any errors, and then print the data. To accomplish this, you must assign three actions to one menu option-"Enter data using a form," "Browse and edit rows in a table," and "Print reports." The Application Designer limits each application to 100 actions, regardless of their distribution in menu options.

When the user chooses an option that has more than one action assigned to it, the application executes each action in turn. When one action finishes, the application immediately executes the next action. When the last action finishes, the application returns to the menu that contains the option, just like a single-action option.

You can assign the following types of actions to menu options:

For many of the menu actions, you can enter a WHERE clause to specify the data to display and the order to sort the data. You can also enter a WHERE clause with the "@" symbol to prompt the user for information.

For example, you might want to display data for a customer, and ask the user for the customer ID number by prompting "Enter the customer number." You could enter the following WHERE clause:

WHERE custid = @'Enter the customer number'

To assign an action to a menu option:

  1. In the "Application Express" window, with the right mouse button, click on the menu option to which you want to assign an action and choose Menu Item Settings...
  2. In the "Menu Item Actions" dialog box, define the action(s) for the selected menu option. The actions will be executed in the order they appear in "Current Actions."

    The "Menu Item Actions" Dialog Box

  3. Depending on the action you selected, do the following:
    If you selected... Do the following...
    Enter data using a form In the "Action Definition" dialog box, select a form.
    Edit data using a form In the "Action Definition" dialog box, select a form, and optionally enter a WHERE clause to specify the data to display.
    Delete rows from a table In the "Action Definition" dialog box, select a table, and optionally enter a WHERE clause to specify the data to delete.
    Browse and edit rows in a table In the "Action Definition" dialog box, select a table, specify the column(s), and optionally enter a WHERE clause to specify the data to display.
    Select rows from a table In the "Action Definition" dialog box, select a table, specify the column(s), and optionally enter a WHERE clause to specify the data to display.
    Update a column in a table In the "Action Definition" dialog box, select a table, specify the column, enter a value to insert, and optionally enter a WHERE clause to specify the data to modify.
    Print reports In the "Action Definition" dialog box, select a report, and optionally enter a WHERE clause to specify the data to print.
    Print labels In the "Action Definition" dialog box, select a label, and optionally enter a WHERE clause to specify the data to print.
    Custom actions In the "Message" dialog box, enter the name for the command block and click the OK button. In the "RBEdit" window, enter your code for this custom action or open an existing file to use. When you have finished, choose File: Save, then choose File: Close.
    Set user identifier In the "Message" dialog box, enter the user identifier. (If you want to prompt the user for the identifier, do not enter anything.)
  4. Click the Done button.

    Repeat Steps 2, 3, and 4 for each action you want to assign to this menu option.

  5. In the "Menu Item Actions" dialog box, click the Done button.