Prepare for import from file

Command group Flag affected Reversible Execute on client Platform(s)
Importing and Exporting YES NO NO All

Syntax

Prepare for import from file {export-format}

Export Formats

Delimited (commas)
Delimited (tabs)
One field per line
Omnis data transfer
Delimited (user delimiter)

Description

This command prepares Omnis for a series of Import data commands. You must specify the format for the import data as the parameter, otherwise an error will occur. The parameter can contain square bracket notation but must evaluate to a valid import format name. You should use the Set import file name command to specify the name of the file to be read in.

If the data matches the specified import format, the flag is set. However, if the data does not match the import format, the flag is cleared.

When data is imported via a method rather than the Utilities menu, you must open a window which defines the fields in which the incoming data must be placed. The example below shows a typical import data method.

You can use a $control() method in conjunction with the Import data command.

If there are too few fields on the window, imported fields will be lost. If there are too many, the extra fields are cleared. You can use the Do not flush command to speed up the import when there is only one user logged into the data file.

Example

; import from a csv file called myImport.txt in the root of your omnis tree
Calculate lImportPath as con(sys(115),'myImport.txt')
Set import file name {[lImportPath]}
Prepare for import from file {Delimited (commas)}
Import data lImportList
End import
Close import file