602SQL Documentation Index  

Table or Query Contents in the Grid

The basic tool for displaying and modifying data in tables or query results is a window called the Grid. You can use the grid for displaying data from OBDC data sources, however the full functionality of the grid is not guaranteed in this case (depending on the ODBC driver of the database). The window is a two dimensional table, where the rows correspond with database records and the columns correspond with the actual columns of the table or query. The column names in the grid header are composed from the data source columns (table or query). You can set the alias name for the grid when designing a table instead of the table column (designer tab Grid). You can set the font used in the header and cell contents in Local Settings section of the Control Panel. A grid can be controlled from a special toolbar and with commands from the Data menu. Grid records can be sorted and selected according to column values.

Moving Through the Grid

When working with the grid, one records is always active. The active record is the record that is currently being edited or that has the thick frame around the column (active cell). The first record and first cell is active when the grid is opened. The active record or cell does not have to be in the visible part of the window. You can watch the active record position in the status bar. It will display: On Record N of M or On Record N of unknown count.

Moving through the grid may be interpreted in two ways. Change the position of the active record or change the area of visible records without changing the active record. The first way can be done using the toolbar buttons or with the corresponding commands in the Data menu. Moves without changing the active record position are done using the vertical scroll bar. NOTE: The scrollbar position does not tell you about the actual record count in larger grids, since the grid window does not know the actual record count. In order to see the real record count jump to the last record using the appropriate toolbar button.

You can only move the active record using the keyboard (using the up and down arrows or using the Page Down and Page Up keys). The Ctrl+down arrow jumps to the end of the grid end, only in the case that the last record is already known. If it is not known, the active record will jump to the last known record. Ctrl+up arrow jumps to the beginning.

You can use the Insert key to jump to the end of the grid (to the fictive record).

You can select a column in a record using the arrows, the End and Home keys, or using the horizontal scroll bar. The Enter key has the same effect as the right arrow key, but also switches to the next record after the last column in the current record. You can move to a specified record using the Go to column... command in the Data menu or using the Ctrl+G shortcut.

Data Modification

You may edit one cell at a time in the current active record. If you move to another cell in the same record, the edit mode will be terminated, but the changes will not be saved. Changing to a different active record will save the changes. The record that was changed but has not been saved yet is marked with a cross on the left row header.

Cell Types

An edit field is used for most data types in the grid. A checkbox that may be TRUE, FALSE and NULL, is used for BOOLEAN type. A separate window is used for CLOB and NCLOB types. You can set a combobox instead of the edit field in the table designer for the column that is filled with values (table designer tab Grid). The grid does not allow you to see and modify cell contents of binary variable-length types (BLOB and PICTURE), only the type name is displayed.

Triggers and referential integrity action may be executed from modifications in the grid. Changes done in these actions can be seen when the grid contents are refreshed. You are not allowed to bypass constraints in the table definition (unique indexes, conditions, etc.).

Edit Mode

In order to modify a cell, you must switch to edit mode. You can switch to this mode by double clicking a cell that is not active, clicking on an active cell or use the F2 key. You can set the new value directly by typing into the cell for most types (except for checkbox). Use the Space key for checkboxes, each press of the Space key sets the next checkbox value.

You can terminate edit mode by pressing the Esc key (changes are removed), Enter or Tab key (changes are saved). If you click on another grid cell, the changes will be saved, if you click on another record, the changes will be saved to the database.

If you press the F12 key on the DATE, TIME or TIMESTAMP type cell, the contents will change immediately to the actual date or time without entering edit mode.

The cell format of individual types is set by Local Settings section settings. Values entered in a different format will not be saved. This mainly affects date, time, and real numbers.

Inserting records

The last grid row is used to insert a new record. The last row (the fictive record) is marked with an asterisk. This row is not a part of the database until it is saved. BEWARE: You cannot affect the new record position in the table and it is not guaranteed that the new record will be at the end of the table!

You can switch to the new record line by using the Insert key.

A new record that is being edited can be saved by changing the position of the active record (e.g. using the up arrow or Insert key).

Selecting and Deleting Records

The record you want to delete must be selected first, being the active record is not sufficient. You can select the record by clicking on the record header or with the Ctrl+Space keys. Activate the Delete selected records command to delete the records (a warning will be displayed before the records will be deleted). You can also use the toolbar button.

This command deletes all records that were selected. You can select more rows by clicking on the first row, holding down the Ctrl key and clicking on the other rows you want to select. You can also select a block of records by clicking on the first record, holding the Shift key and clicking the last row in the set.

You can delete all records in the grid using the Data / Delete all records commands or use the toolbar button.

It is recommended to use the DELETE or Truncate_table SQL statements for deleting a large number of records. The response will be much faster.

Refreshing the Grid

The Data / Refresh data menu command (or a toolbar button) allows the data in the grid to be refreshed. The grid content is read from the data source again (if the source is a query, it will be evaluated again). Grid positions are preserved.

Copying Records using the Clipboard

You can copy the selected record to the clipboard using the Ctrl+C. Ctrl+V will paste the record to the same table, to a table with the same structure or into a query of the same structure. If you past the record to the new record line, the record will be inserted. If you paste it on an existing record, the original record will be replaced with the new values.

You cannot move more than one record this way.

BEWARE: You cannot used the Copy and Paste buttons on the toolbar. They are used only for objects in the Control Panel.

List of topics: