opentextfile
FILE

The opentextfile statement imports data from a text file or a variable into the current database.


Parameters

This statement has one parameter:

file – identifies the file you want to import. If the file is not in the same folder as the current database, you must specify the entire path name in addition to the file name, for example: "~/Documents/Accounting/July.csv".

If this parameter begins with a + symbol, Panorama will append the file to the current database, with the first field appended to the first field, second field appended to second field, etc.

If this parameter begins with a & symbol, Panorama will replace the data in the current database with the data in the file. The fields will be replaced in order, with the first field replacing the first field, second field replacing the second field, etc.

If this parameter begins with a @ symbol, Panorama will import from a variable instead of from a text file. For example, "@mydata" tells Panorama to import from the variable mydata. This symbol may also be combined to append (+@) or replace (&@) the text from the variable.


Description

Note: In Panorama 6 and earlier, the opentextfile statement was the primary method for importing information. For compatibility with older databases, the opentextfile statement has been retained, but we recommend that for new applications you should use these newer statements:

These statements give you more control, and avoid tricks with the +, & and @ symbols.


The opentextfile statement imports into an existing database. In operation it is identical to the openfile statement, but it will try to open any file as a text file, even if the operating system doesn’t think it contains text.

This procedure allows the user to select a TEXT file, then appends that text file to the current database.

local  file,folder,type
openfiledialog  folder,file,type,"TEXT"
if  file=""
   stop  /* the user pressed the CANCEL button */
endif 
opentextfile "+"+ folderpath( folder)+file

The example procedure below replaces the contents of the file Telemetry Data with the new data in Telemetry.TXT.

openfile "Telemetry Data"
opentextfile "&Telemetry.TXT"

See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, but no longer allows HTML import.