Editing Data
There are four levels of control for editing data in Edit. Each level of control provides specific ways to display, modify, insert, delete, and copy data.
- Menu Bar
- Select commands from the menu bar in the Table Editor to control all tables displayed in the Table Editor.
- Edit Window Toolbar
- Select commands from the toolbar in an edit window to control the specific table displayed in the edit window.
- Grid Heading Shortcut Menu
- Right-click a grid heading of a column in the edit window grid to display the grid heading shortcut menu. Select commands from a grid heading shortcut menu to control the specific column in a table. The grid heading shortcut menu contains commands that allow you to find, replace, exclude, include, sort, and hide rows based on the data contained in the column in which you right-clicked.
- Grid Column Shortcut Menu
- Right-click a row in the edit window grid to display the grid column shortcut menu. Select commands from the grid column shortcut menu to control the specific row you right-clicked. Along with the normal cut, copy, and paste options, the grid column shortcut menu contains commands that allow you to clear, insert, repeat, and delete a row.
In this scenario, you edit data in several ways using commands from each of the four levels. By doing so, you sample some of the tools and functions available in Edit. You also prepare to understand the functions available to undo editing changes, discussed in the next section.
Refer to Table Editor Components for information about the Table Editor menu bar, the edit window toolbar, and the shortcut menus.
Overtype
You can modify data by clicking a grid row and overtyping the data. Click the ADDRESS column in the first grid row of the edit window containing the CUSTOMERS table. Change the address to “1600 Pennsylvania Ave.” and then click outside the row to commit the change to the database.
You can overtype data in any column. If you change data in a primary key column that results in a violation of referential integrity rules, a warning message displays.
Replace
You can selectively replace data in a grid column. For this scenario, use Replace to replace all occurrences of the ‘62700' zip code with ‘99999'.
Right-click in the heading of the ZIP column of the CUSTOMERS table. Click Replace on the grid heading shortcut menu to display the Replace dialog.
Type 62700 in the Find what box and type 99999 in the Replace with box. Select the Wrap check box in the Direction group box. You can find each occurrence of the zip code and selectively replace it by clicking Find Next, then Replace. Click Replace All to replace all occurrences.
The Status bar of the Replace dialog indicates the number of replacements performed. Click Close to return to the Table Editor.
Exclude
You can selectively exclude data in an edit window. For this scenario, use Exclude to hide the rows with the 99999 zip code.
Right-click in the heading of the ZIP column and select Exclude from the grid heading shortcut menu. Type 99999 in the Find what box. Select the Wrap check box in the Direction group box.
Click Exclude All to hide all rows with the zip code 99999 from view. The Status bar shows the number of rows excluded. Click Close to return to the Table Editor.
A bold line separates rows before and after excluded rows. Position the pointer on the bold line to display the number of excluded rows represented by the line.
To show excluded rows, right click in the row that precedes the bold line and select Show Next or Show All from the grid column shortcut menu.
Repeat
You can copy and repeat a row in the edit window using the grid column shortcut menu.
For this scenario, click the grid row of the CUSTOMERS table containing the address “1600 Pennsylvania Ave.” Right-click and select Repeat from the grid column shortcut menu.
The row containing the “1600 Pennsylvania Ave.” address is repeated.
Since the repeated row does not have a unique primary key, the status column of the row indicates that the row has an error. Additionally, an error message displays in the message bar.
To resolve the error, type a unique value in the primary key column.
Type “99999” in the CUST_ID column. Click outside the row to commit the change.
Modify the other columns of the inserted row by overtyping the data in the row, as follows:
- Overtype the name of the customer in the CUSTNAME column of the inserted row with the name “XYZ Video.” Press the Tab key to move the pointer to the ADDRESS column. The status of the row changes to Pending (Upd).
- Overtype the address with a new address, “123 Main St.” then press Tab M to move the pointer to the CITY column.
- Overtype the name of the city with a new name, such as “Anytown.” Click outside the row to commit the changes to the database.
The status of the row changes from Pending (Upd) to Updated.
Insert
You can insert a new row from the grid column shortcut menu.
For this scenario, click the grid row of the CUSTOMERS table containing the value “00210” in the CUST_ID column. Right-click and select Insert from the grid column shortcut menu.
Type the unique primary key value “99998” in the CUST_ID column of the newly inserted row.
Each time you edit a row and commit the change to the database, Edit tracks and records the change as an Undo Level. To set up the demonstration of the undo capability of Edit in the next section, enter data in the new row one column at a time. Commit the change to each column by clicking outside the row after each change.
Edit the following columns.
- Type “Movie Time” in the CUSTNAME column.
- Type “3 High St.” in the ADDRESS column.
- Type “Anytown” in the CITY column.
- Type “NJ” in the STATE column.
Each time you click outside the row, the change to the row is committed to the database and the status of the row is Inserted.