The Table Browser is a tool for working with tables. You can use the Table Browser to enter and edit data in the table. In addition, you can use the toolbar on the left side of the Table Browser to perform a variety of table-related maintenance tasks including modifying the table’s structure, adding one or more index orders, packing the table (removing deleted records), rebuilding its index files, and encrypting and decrypting the table.
This section describes the basic use of the Table Browser including how to open tables in it, as well as how to navigate and edit those tables. Using the table maintenance features of the Table Browser is discussed later in this chapter.
After you have finished creating a table structure, you are given the opportunity to open the newly created table in the Table Browser. This feature is useful if you immediately want to enter some data into the newly created table, or to perform some maintenance function such as defining indexes for the table. Once you are through working with your new table, you simply close the Table Browser.
The Table Browser can also be used on tables that already exist. To open a table in the Table Browser, select File | Open Table from the Advantage Data Architect main menu.
The following steps demonstrate how to open a previously created table:
If your CUST.ADT table is already open in the Table Browser, close the Table Browser by clicking the Close button in the upper-right corner of the Table Browser window.
Select File | Open Table from the Advantage Data Architect main menu. The Advantage Data Architect responds by displaying the Open Table(s) dialog box, shown in Figure 2-4.
Figure 2-4: Use the Open Table(s) dialog box to display an existing ADS table in the Table Browser.
Select the Path radio button in the top portion of the Open Tables(s) dialog box, and then click the Browse button. Use the displayed Browse for Folder dialog box to select the directory into which you saved the CUST.ADT table you created in the preceding section of this chapter. Click OK once you have selected the path to return to the Open Table(s) dialog box.
Click the Browse button associated with the File(s) field, and then select CUST.ADT from the displayed dialog box. Click OK to return to the Open Table(s) dialog box.
You probably do not have to change any of the settings in the Open Options section of the Open Table(s) dialog box, but make sure that Table Type is set to Auto Sense, and that all three checkboxes are enabled in the Server Type section. If they are not, make the necessary changes.
If you are opening a free table for editing, as you are in this instance, and there is more than one index for the table you are opening (which there is not in this case), you would need to click the Additional Indexes button, and choose all of the indexes that are associated with this table. Failure to do so would make it likely that those indexes would become corrupt if you were to post any changes to the table. This is only a problem with free tables, as additional indexes are automatically opened when you work with database tables. Click OK to open this table in the Table Browser, as shown in Figure 2-3.
You can open two or more tables at the same time from the Open Table(s) dialog box, as long as these tables are in the same directory or the same data dictionary. To open more than one table, select the two or more tables that you want to open from the Open dialog box (which you display by clicking the Browse button associated with the Files field). Or, you can enter a semicolon- separated list of table names in the File(s) field.
Once you have opened a table in the Table Browser, the caption in the Table Browser title bar provides you with information about the table. In addition to the fully qualified filename of the table you opened, the type of table (ADT in this case) and the type of connection used to open the table (REMOTE in Figure 2-3) are displayed in brackets following the filename. After the brackets are parentheses, indicating the total number of connections that were currently viewing this table at the time the Table Browser was opened.
Using the Table Browser, you can add, remove, and modify records in a table. For all basic data types, such as CHARACTER, INTEGER, LOGICAL, and DATE, you can simply navigate to the field whose data you want to change and enter or edit the data using your keyboard. The standard keyboard shortcuts allow you to cut (CTRL-X), copy (CTRL-C), and paste (CTRL-V) data. For MEMO fields, simply double-click on the MEMO field, and a small editor window will be displayed. Close this window when you are done changing the contents of the MEMO field. You can also double- click IMAGE fields to view their contents in a small editor window, although it displays a limited subset of the data. You can add, remove, and modify IMAGE data using the keyboard shortcuts.
Basic navigation is supplied by the navigator control (shown next) that appears in the lower-left corner of the Table Browser. The available navigator buttons, from left to right, perform the following tasks: First record (go to the first record), Last record (go to the last record), Insert record, Delete record, Post edit (post additions or changes), Cancel edit (cancel additions or changes), and Refresh data. Pause your mouse pointer over one of the buttons of the navigator briefly to see a fly-by help window describing the purpose of that button.
In addition to posting changes to a record using the Post edit button of the navigator, any changes that you made to a record are posted if you then navigate to another record in the Table Browser.
You can also navigate your table using the cursor keys on your keyboard. For example, LEFT ARROW and RIGHT ARROW and TAB and SHIFT-TAB permit you to navigate between columns on the current record. Similarly, UP ARROW and DOWN ARROW and PAGE UP and PAGE DOWN permit you to scroll between records.
You can also navigate with your mouse. To select a particular record/column cell that is currently visible in the Table Browser, click on the cell. To navigate to a record that is not currently visible in the grid, click on the grid’s scrollbar until the record you want is visible.
So long as you have not opened a table in exclusive mode, the Table Browser permits you to modify the contents of a table in a multiuser environment, meaning that other users could possibly be viewing and even editing this same table at the same time you are. In order to coordinate the edits by multiple users, just as you begin editing a record, a record lock is placed on that record, meaning that while other users will be able to view that record, no other user can edit that same record until you have released the lock. The lock is released when you click the Post edit button of the navigator, or move to another record, in which case your changes will be automatically posted.
Use the following steps to demonstrate the editing of a table’s contents:
With the new CUST table still open in the Table Browser, move to the Customer ID field and enter 12688. For First Name enter Frank, and for Last Name enter Jones. Similarly, set Date Account Opened to 5/9/1983 and Active to T.
Now double-click the Comments field for this first record. The blank memo opens in a window, like this:
Enter the following text into the memo window: Our first customer. Close the memo window when you are done.
Click the Post edit button on the navigator (the button with the checkmark). Notice that after the record is posted, the contents of the memo field now display “(MEMO).” The capital letters indicate that there is data in the Comments field.
Select the first record in the table and press DOWN ARROW. Doing this opens a new record. Enter data for three more records using these same techniques. The data that you should enter can be found in Table 2-4. Once you have entered data for the last record, click the Post edit button or move to a different record to post the last record’s data.
Date Account Opened