Pan 6 batch import question

Is there a way to batch import a number of text files from a single folder into Pan? Goal is to take 6-8 individual text files and turn them into a single PAN database.

Panorama is able to list the contents (see documentation for the fileinfo( function) of a chosen folder (read about openfiledialog) as an array. Then you would loop through the elements of that array and use the file names to set the value of a variable, which you would use as argument for the openfile (or opentextfile) statement. When you use the prefix “+” with the file name, the file will be appended to existing data in your database.

In case someone else needs an answer. This one works if your text files/csvs are in the same folder as the pan file:

//*******Checks folder, counts only text files, opens the first one, then loops to open the rest. *****
local vChoice, vFilesList,vNum,vSize

vFilesList=listfiles(folder(""),"TEXT????") //see pan formulas p168 for other options
opentextfile "++"+str(vChoice)
deleterecord //will delete the first line of the import

    opentextfile "++"+str(vChoice)
    deleterecord //will delete the first line of the import
until vNum=vSize

You could delete lines 9, 10 11 and 12 (from vNum=1 to just before ‘loop’) and the procedure will run equally well .

1 Like

I think you meant “listfiles”, not “fileinfo”…

The **listfiles(** function builds a text array listing the files in a folder.

The **fileinfo(** function returns information about a file (or folder) on the disk, including the size, creation and modification date and time, type, creator and lock status.
1 Like

How did this post from 2018 get resurrected today? :thinking:

I’m hoping @barry_kahn has moved on to Panorama X by now!

Aw wow I didn’t even notice the date. But responding to old posts is my specialty :slight_smile:


1 Like

Oh, another post from a company that’s still using Pan 6/enterprise for our data, and I know I search these forums daily for tips and tricks to keep it working. So, I wanna leave the breadcrumbs for anyone else!

We’re moving to the web for a lot of things, but you know how long development takes!

I’m one of the 6 or so people hammering away at keeping things working in the meantime. Pan 6 is my first programming language, so I have you to thank for getting me to dive into Python and SQL over the last year!

Oooh, since I have you here, what language would you say that Pan 6 is closest to? I do a lot of editing and source control through VS Code and have had the interpreter use Visual Basic, CoffeeScript, Groovy, and a few others for color coding to make things easier, but I would love to know if it has a cousin that VSCode might have an intellisense for!

Oh! That’s a solid point!

Since vNum=0 the start of the loop would make it 1. Nice! Thanks for the tip.

And I thank you and all others like you, daily!

Just want to chime in to make sure that you are aware that Panorama X Server is in beta, and will be officially released soon. Almost all of what you have done with Panorama 6 Server will move over to the new system.

Thank you for the heads up. It’s definitely on the list of options once it’s available! I do enjoy how fast and powerful It is.

Do you have any thoughts on what languages are closest to Pan 6’s language? I’d love to hear from you since you created it and I wonder what inspired you daily.

The origins of Panorama’s programming language go back to 1983. Most of the languages you’ve heard of today didn’t exist at all then, so they weren’t any influence. This would include Java, JavaScript, Python, Ruby, PHP, Perl and many others. Languages I did have some experience with by 1983 included C, Pascal, a bit of PL/1, some BASIC, and 8080 and PDP-11 assembler.

Panorama’s language wasn’t based on any particular existing language. One thing I did want to do was avoid the technical syntax of C, so for example there is no semicolons and no curly braces. Though it wasn’t based on it, I would say one influence would be the dialect of BASIC than ran on Alpha Micro minicomputers. I worked at Alpha Micro in the late 1970s, and though I didn’t personally use BASIC much, the Alpha Micro dialect was a pretty good language for non-programmers, but a lot better than the original BASIC. For example, the Alpha Micro dialect didn’t require line numbers. In fact if I remember correctly the control structures in Panorama’s language are pretty much inspired by this version of basic. For example:

if a=b
    do something

While in C (or C derived languages, like JavaScript), this would be written:

if (a==b) {
    do something;

Note the strict requirement of parenthesis around boolean logic, the use of curly braces to identify blocks of code, and the requirement of a semicolon at the end of each statement. I thought all of those would be tricky for typical end users that had never been exposed to those idioms (which in 1983 was almost everyone).

Of course the language has evolved a lot over nearly 4 decades. I would say it is both a strength and a weakness that the language has evolved far beyond it’s original roots. It’s much more powerful, but not as organized as it would have been if it was designed all at once, or even it had started twenty years later when there was a lot more existing languages for inspiration.

1 Like

Very cool! Thank you so much!