Insert and Delete/Revert

The Insert Record (Insert Record icon) and Delete/Revert Record (Delete/Revert Record icon) actions let you stage rows in a database table for insertion or deletion. The actions are quickest to invoke by keyboard shortcut (Ctrl+Shift+Plus and Ctrl+Shift+Minus), but are also shown in the toolbar and in the Edit menu.

A perspective with pending data edits, with two pending inserts and one pending delete. The perspective is of academic courses and, for each course, a reading list; the pending edits are in the reading lists. The toolbar is visible, with the Insert Record and Delete/Revert Record action icons highlighted. The Data Editing mode status bar is also visible, including the hint that shows the keyboard shortcuts Ctrl+Shift+Plus/Minus for insert and delete.

Ultorg perspectives can include data from multiple data tables. The table to insert to or delete from is determined by the position of your cell cursor.

Like other data edits, insertions and deletions are committed to the underlying data source only once you press Apply Edits (Ctrl+Shift+S).

The term record here means a table row in the underlying database. In an Ultorg perspective, a record can be displayed as either a row in a nested table or as form fields in a form layout.

Inserting a Record

For a perspective showing a single table of data, you can press Ctrl+Shift+Plus from any cursor position to insert a new record. The new record appears at the top, highlighted in green.

A pending insert in a simple perspective showing a single table from a database. No values have been entered yet in the new row. A '+1' indication is shown for the primary key field 'ID', indicating that a value may be auto-generated if not explicitly specified.

Move the cursor to edit individual cells in the inserted record. Make sure that all of the fields (table columns) that you want to fill in are visible.

The example from the previous figure continued, with some values now entered in the record to be inserted. Explicitly defined values are shown in a strong shade of green.

The +1 notation is shown for cells that will hold primary key values. These can be specified manually or, in some cases, auto-generated by the data source.

When you press Apply Edits, the new record becomes officially inserted into the underlying data table, and the perspective is refreshed. The new record may appear in a different visual position, often at the end of the table, or in an explicitly sorted position, possibly out of view.

The example from the previous figure continued, after Applied Edits has been invoked. The freshly inserted row can now be seen at the very end of the database table.

Inserts in a Subquery

An Ultorg perspective can display data from multiple data tables. A hierarchy of subqueries is used to visualize one-to-many relationships between tables. The Insert Record action works in the context of these relationships.

To insert a record in a one-to-many relationship, move the cursor to any existing record in the same group, and press Ctrl+Shift+Plus. The new record appears in green:

A perspective that has a single pending inserted record under the Readings subquery, with no values yet entered in the inserted record. The Data Editing mode status bar is visible.

You can then edit values in the new record, like in the previous example.

When you insert a record in a subquery, Ultorg automatically fills joined field(s) with the corresponding value from the parent record. You can see how this works by making the relevant ID fields visible:

The perspective from the previous figure, with ID fields visible to show the effect of the pending insert in the Readings subquery.

In this example, inserting a record in Readings under the course that has an ID of 191 causes the inserted record to have a Course ID of 191.

Type to Insert

If you type a value in an empty group, a new row will be inserted automatically.

Illustration of the auto-insert feature, where the user can type values into an empty group to automatically insert a new row.

Defaults and Auto-Generated Values

When inserting, some data sources provide default values for certain table columns, or generate values for them automatically. Such values will appear after you invoke Apply Edits.

For example, the following table generates values on insert for the ID and Code columns:

Applying a pending insert for a column that auto-generates values for two of its columns ('ID' and 'Code').

You can override default values by entering a value for them. The Delete key can be pressed to produce an explicit null value, or pressed again to let the database supply a default value.

When inserting a new record, explicitly defined values are shown in a stronger shade of green.

An inserted row with one specified value and several unspecified ones. The cell with a specified value is shown in a stronger shade of green. The cell cursor is on a cell with an unspecified value, which is shown in a lighter green, and with an explanatory message in the formula bar in grey. The indications are subtle, though the user does not usually need to pay too much attention to them.

If desired, you can configure fields that should not be edited as read-only.

For checkbox fields in inserted records, Ultorg sets an explicit unchecked (false) value as a starting point, rather than leaving the value undefined. This makes subsequent editing easier.

Nested Inserts

You can insert records under other pending inserted records. If the parent has an auto-generated primary key, the generated value will be substituted in the child record as appropriate when Apply Edits is invoked.

Two insert operations pending, where one inserted row references the auto-generated primary key of an inserted parent row.

Deleting a Record

To mark a record for deletion, move the cursor to any of its cells, and press Ctrl+Shift+Minus. The record to be deleted will be shown in red with a strikethrough:

A perspective with a deleted record in a subquery. A red strikethrough indication is shown for the deleted record.

If the record to be deleted had existing edits, you may need to press Ctrl+Shift+Minus multiple times, so that the changes are first reverted (see below).

Pressing Ctrl+Shift+Minus again on the same record will un-delete it. Deleting an inserted record will un-insert it.

When deleting records across multiple tables, the Apply Edits operation will automatically order the operations so as to avoid temporarily broken foreign key references.

Reverting Edits

When Delete/Revert Record (Delete/Revert Record icon) is invoked on a record with existing edits, the existing edits are reverted. If the cursor is on an edited cell, only that specific edit will be reverted; otherwise, all edits in the record is reverted.

Reverting an edit in a single cell, by moving the cell cursor to the edited value and pressing Ctrl+Shift+Minus (Delete/Revert Record).

The revert can itself be undone with Undo (Undo icon, Ctrl+Z/⌘Z), like most other actions. A quick revert-plus-undo can be useful to see the previous value of an edited cell.