Prepare for insert

Command group Flag affected Reversible Execute on client Platform(s)
Changing data YES YES NO All

Syntax

Prepare for insert

Description

This command prepares Omnis for inserting new data into the main file. It clears the main file and prepares to insert a new record into the main file. All Read/write non-main file records in the current record buffer are reread if a record has been changed. You can edit data in all the read/write files in the buffer, other than the main file.

The Enter data command is required only if the user is to enter data via a window. Data is not written to the disk until Update files is executed.

Prepare for edit/insert mode is cleared only by a Cancel prepare for updateUpdate files or a Quit all methods command. You can build lists, print reports and change the main file in the middle of an insert without canceling the Prepare for... mode.

If the main file is changed while in Prepare for insert mode, the main file at the time of the Prepare for insert is used when Update files is encountered.

In multi-user mode, the Prepare for... commands reread the current records from the data file if another user has edited a record.

Example

; The following example is equivalent to the 'insert record' on the commands menu which can be
; installed using 'Install menu *Commands'
Prepare for insert
Enter data
If flag true
  Update files
Else
  Clear main & connected
  Redraw {wMyWindow}
End If