Importtext question

Is there any way to “skip first line” when a procedure does an importtext?

Sure, a procedure can do anything you want. The arrayrange( function is most likely the primary tool for this.

To strip off the first line you would use a formula like this:


The formula above assumes the lines are separated by carriage returns, but in many instances lines are separated by linefeeds. A simple modification allows it to work either way:


Here’s one way this could be used with importtext statement

importtext arrayrange(lftocr(text),2,-1,cr())

Of course you could add other options to the importtext statement if needed.

If the text is in a disk file, you can use the fileload( function to load it.

importtext arrayrange(lftocr(fileload(filepathandname)),2,-1,cr())

Depending on the contents of the file you may also need to use the binarytotext( function – see this help file for details.

Is there anything that PanoramaX can’t do? This program continues to amaze!
Thanks Jim

I have always said to potential clients or users, ‘If you can define it, Panorama X can solve it’. I haven’t yet been proven wrong.

1 Like

In yesteryear, I’d have to import text data and some would contain a “heading” (field name) and some wouldn’t. There would usually be a field I could test - like if the City field equaled “City”. Can’t just look for Contains “City” because, you know, Kansas City and the like.

So after the import, I’d just check the content of a field in the first record. If it was the imported data’s field name, I’d delete that record. Extra points for making sure it was not the only record (could happen - file with only the header record)

In your case, it sounds like you know you will always have a header record. So you could just move to the first record (I don’t like to assume I’m there) and delete. If you take the time to check first, you won’t have to change your process if the header record goes away.

There are certainly times this could be a good, easy technique, and in older versions of Panorama this was the only technique available. I do want to point out that this suggested technique is assuming that the import is replacing the existing data – it could be appending. In that case it is not so straightforward to move to the first imported record (though actually, I think Panorama leaves the current record on the first imported record, so you could just proceed).

This technique is also based on the assumption that the field “names” in the imported text exactly match the field names in the Panorama database, which may or may not be true.

You are correct sir! I was pretty sure that import would leave me on the first record. But you know … just in case :slightly_smiling_face:

The “City” was not the most generic example. When I had to do check that, I usually just checked for alpha characters in a field that is supposed to just have numbers - not a specific name. My general purpose “importer” app had a check box for leaving the first record or not.

And I considered the Append issue. But the user did say “import” - though I can see now that import could mean replace or append.

What an interesting world of possibilities. It’s pretty cool to import to holding area for “pre-processing”.

Many ways to peel that banana <- a courtesy to my vegan friends.