Unwanted null record from importtext


#1

i’ve got a ¶ separated array loaded into a variable named tgs. the array has 42 elements.
i then do
    newdatabase
    importtext tgs
this results in a database with 43 records: the 42 i expected and an empty record.
is this to be expected?


#2

Since a database must have at least one record the newdatabase is created with one blank record and your import then simply adds your additional records. I would change your code to"

newdatabase
openfile &@tgs

Openfile can also be used to import text and by using the & it tells Panorama to replace the existing data while the @ tells it you are importing from a variable.


#3

well, of course.
i’m trying to train myself to use the to use the new dialect.
i think i could also have done
    importtext tgs, ‘existingdata’, ‘replace’


#4

FTW! Yes, you correctly answered your own question :slight_smile:

If you look under the hood, you’ll see that in Panorama X, openfile is actually a custom statement, and it is using importtext to do the import. So you are really using importtext either way.