Next, we will add the actions for modifying information in the tables. The Modify pull-down submenu options allow users to edit or delete employee, customer, or flight information. You want users to use a form to edit the data. In addition, you want users to be able to identify the row to edit, so you'll define a WHERE clause that allows them to select the row by entering the data specific to that row. For the action to modify an employee's record, we will use the employee's last name to pull the correct record to edit.
To define the action for editing data:
1. | With the "Add Actions to Your Application:" screen, in the Application Wizard, still displayed, select the "Add" button. |
R:BASE displays the "New Item" dialog.
2. | Enter "Modify Employee" in the "Caption:" field. |
3. | Choose "Edit Data Using a Form" from the "New Action:" drop down box. |
4. | Click the "Add" button. |
R:BASE displays the "Available Forms:" dialog.
5. | Choose EmployeeForm from the drop down box. |
We want to build a condition based on the employee's last name. When the application option is chosen, we want to be prompted to enter a last name, and then have that row selected.
6. | Click the "WHERE Builder" button. |
The "Where Builder" dialog box is displayed. R:BASE knows that the form EmployeeForm is based on the Employee table. Employee is selected in "Table Name" and the columns in the Employee table are listed in "Select Columns".
7. | Select EmployeeLastName column in the "Select Columns" panel. |
8. | Click the "Add Column" button. |
The column EmployeeLastName is displayed in "WHERE Clause" panel.
9. | Click the "LIKE" button in the "Operators and Keywords" panel. |
The LIKE operator is added to the "Where Clause" panel. By selecting the LIKE operator, we can retrieve data by entering a complete employee last name, or using a wildcard character, we can enter just part of a last name. The wildcards are useful for searching for more than one row when the first few characters are known.
Wildcard characters are used to represent one or more characters in a search. The default R:BASE wildcard characters are the underscore _ (one character) and the percent % (one or more characters). For example, the underscore can be added to the end of the last name search of "Mil" and would return valid values ranging from "Mila" to 'Milz". Using the percent the end of the last name search of "Mil" would return valid values that begin with "Mil" with no limit on the additional characters in the last name, like "Miller" or "Milbourne". It is more likely that the many wildcard character will be used.
10. | At the end of "LIKE" enter "@'Please Enter Employee Last Name:'" in "WHERE Clause" panel. |
The "@" indicates to R:BASE that a dialog message follows. The dialog message is displayed when the application option is run. Do not put a space between the "@" and the message.
11. | Click the OK button. |
The "Available Forms:" dialog is displayed with the WHERE clause you built in the WHERE Builder.
12. | Click the OK button. |
The "New Item" dialog box is displayed with the complete command to perform the action for the "Modify Employee" menu option. If you have not added an image to the action, you can do so.
13. | Click the OK button. |
A fourth action is now displayed in the list of actions for the Application Wizard.
Now, add two more actions in the Application Wizard for "Modify Customer" and "Modify Flight". Both actions will use the predefined action for editing data using a form, but the WHERE Clause for each search will be different. The search on the Customer table will be based on the customer last name, while the WHERE Clause for the Flights table will be based on the flight date.
Using the following:
Modify Customer
•Enter "Modify Customer" for action "Caption:"
•Select the "Edit Data Using a Form" predefined action and the CustomerForm form.
•In the WHERE Builder, build the WHERE Clause "CustomerLastName LIKE @'Please Enter Customer Last Name:'
Modify Flight
•Enter "Modify Flight" for action "Caption:".
•Select the "Edit Data Using a Form" predefined action and the FlightsForm form.
•In the WHERE Builder, build the WHERE Clause "FlightDate >= @'Please Enter Flight Date:'.
•While in the WHERE Builder, use the "ORDER BY.." button to sort the column FlightDate in ascending order.
There should now be six actions defined in the Application Wizard screen.