Import data

Command groupFlag affectedReversibleExecute on clientPlatform(s)
Importing and ExportingYESNONOAll

Syntax

Import data
 
list-or-row-name

Description

This command reads the next data item into the the specified list or row variable. You use the Import data command to import data from a file or port. Once you select an import file or port, and issue a Prepare for import command, Import data adds the data to the specified list or row variable.

If a record is successfully read from the file or port, Omnis sets the flag. An error occurs if the import file or port is closed or if the specified list or row variable does not exist. The flag is set after reading a record successfully.

After the import is complete, you should follow Import data with an End import and the appropriate Close import file or Close port.

There is a one-to-one mapping between the columns or fields in the import file and the columns in the list or row variable. Therefore, if there are fewer columns or fields in the import file than in the list or row, the excess import columns or fields are ignored. Likewise, if there are more columns in the list or row than in the import file, the excess columns are left blank.

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