Insert and Delete/Revert
The Insert Record () and Delete/Revert Record (
) 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.
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.
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 +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.
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:
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:
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.
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:
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.
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.
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:
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 () 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.
The revert can itself be undone with Undo (, Ctrl+Z/⌘Z), like most other actions. A quick revert-plus-undo can be useful to see the previous value of an edited cell.