Column Names after script import (Bug?)

I have a csv file with field names in the first record. When I import this file using the File>Import>New Database From Text, I get a new Untitled database and Panorama X has named the columns for me.

Sweet!!

When I record these actions to a procedure I get nothing. After playing around with procedure editor I came up with this:

NewDatabase
Importtext fileload("/Users/terrys/Dropbox/00000_CM_E2P.csv")

That does the import, but, unlike doing it myself, the first record is blank (I presume “NewDatabase” does that, and, with the columns names now in the second row, all the columns are labeled A, B, C, … and the following part of my procedure fails…

window "00000 ChoirMusicPanX"
deleteall
importdatabase “Untitled”,“ExistingData”,“false”,“Selected”,“false”,“MatchingFields”,“true”

I’ll program around this issue. I just thought you’d like to know that procedural steps seem to produce a different result than menu actions.

You should re-read the Pan X Help about the importdatabase statement. The options to that statement are just that: options.

I think the command works better when you have saved the import database already. In my example I named it “YourImportDatabase.pandb”. If you want to replace the previous contents of the importing database, this code will do it:

importdatabase "YourImportDatabase.pandb","EXISTINGDATA","REPLACE"

If you want to keep existing data and to append the imported data, simply use

 importdatabase "YourImportDatabase.pandb"

The menu command File>Import>New Database From Text takes care about the field names, but the importtext statement does NOT care about them . You have to add some code that creates field names from the first line of the imported CSV file.

So you could use this code snippet after your importtext statement:

FirstRecord
Loop Left until stopped
Loop fieldname «» right until stopped
deleterecord /* if you want to delete the first record immediately */

At least in it’s current incarnation, the procedure recorder primarily records actions you take that modify data in the data sheet. It does not record opening/closing files or windows, adding or removing fields or modifying field properties, graphic operations, etc.

Panorama has a handy statement for automating this - newdatabasewithtextfieldnames:

This does exactly what you want, so your procedure will just be one line:

newdatabasewithtextfieldnames "/Users/terrys/Dropbox/00000_CM_E2P.csv"

If you leave the filename blank, Panorama will prompt you to locate the file:

newdatabasewithtextfieldnames ""

I love these new ultra-descriptive statements and I’m waiting for the fixalltheseproblemswhileiputapotofcoffeeon statement.

Thanks Jim, that’s just the ticket.

BTW, your recorder worked for one file open task with a dialog. I don’t remember which. But I was grateful for it because it is from it that I got the correct path. The path that I was originally using didn’t work and I could never figure out why (still don’t know why since they looked identical). Once I copied the path created by the recorder in the procedure editor window though, I was off and running.

If you need a path, just drag the file or folder in question onto the procedure code, like this:

Very cool.

I usually have to drag onto terminal to do that. For some reason that method didn’t work this time, although I can’t say why. There was probably some other little thing that I did wrong.

BTW the help screens are wonderful. I just have to keep reading. Did this program begin as Overvue? You’ve come a long, LONG ways since then.

Documentation is usually unappreciated, if not just simply unread. So thank you very much for the positive feedback. :slight_smile:

Well, there certainly isn’t any OverVUE source code in it. The history is that first there was OverVUE in 1984. Started writing Panorama in 1986, it was obviously a successor to OverVUE, but the code was all new. Started writing Panorama X in 2012, again, almost entirely new code.

That true, and there is a lot more in the pipeline!

Well, OverVUE was the first program I bought for my first Mac in 85 (the 512K “fat” mac). I loved it. Which brings me to a feature request. It was either in OverVUE or one the earlier versions of Panarama that I purchased that I could edit files incredibly fast not only because of the speed of the memory based engine, but also because of two keyboard shortcuts. One (think it was command-F) that called up the formula select dialog for that column. I could issue that command from the keyboard, type in a value and then choose command-F to find or command-S to select. The second (I think it was command-equals) that would call up the formala fill dialog for that column. Between those two commands and the arrow keys, I could get an incredible about of editing done without ever reaching for the mouse, which made it many times faster to use.

I’m working on definehotkeys to gain those capabilities back again. But I haven’t figured it out yet. Right now I have to reach for the mouse to do any kind of find, select, or formulafill other than select all, which feels about as efficient as having to reach for the mouse to copy, cut and paste.

Any chance we could get those shortcuts back again.

Thanks, I look forward to seeing the “more in the pipeline”.

Command-F does open the Find/Select dialog. Depending on the preferences, it will either come up for the current field, or all fields. Sounds like you want to set the preferences to the former.

I’m the lead T-Sql programmer/dba of my group in a big government contractor, so I understand if you can’t implement this. I know that the market drives what you can do, probably more so than bigger companies. I also know that this is still in development so I’m hoping these hotkeys will be available in the final product. Please treat this as just another user feature request and not a complaint.

BTW, I’m the official regex expert and trainer of my group so I REALLY appreciate the addition of a good REGEX engine. I hope at least some of the rest of your users can appreciate how much power you’ve added with this choice. From the documentation I’m presuming you are using the PERL flavor of REGEX.

Anyway, back to my request.

With Panorama 6 I could call up the Find dialog and do a Find, Select, Select Within or Select Additional without leaving the keyboard.

With very few keystrokes I could narrow down my result set to exactly what I wanted create a new column or arrowkey to another column and press command-equals, calling up FormulaFill and write a cascading text funnel formula or anything other formula I wanted.

The important thing for me is, since the Enter key would click the default button in any dialog, I could do all this without leaving the keyboard. Combined with the speed of the database engine, you could do incredible things in an unbelievably short amount of time.

I thought I remembered being able to do Propagate and Unpropagate from the keyboard too, but I may have used QuicKeys to add those to Panorama myself.

Having to reach for the mouse now really slows me down.

You program at a much greater depth than I do, so maybe this suggestion is silly, but perhaps, if the definehotkeys command could add user defined hotkeys to any menu choice, and any button or drop down choice on any dialog, we could do it ourselves.

Great work on PanoramaX!

Since Jim is striving for 100% Apple standards I presume Apple’s built-in options for adding Menu hotkeys to any application (System Preferences>Keyboard>Shortcuts tab) will let you add or change Menu Hotkeys for PanoramaX.

1 Like

You are right. That’s a great tip. I got so used to using QuicKeys back in the 80s and 90s I never caught up to that addition to the Mac OS, partially because the last time I tried to use it, it wasn’t supported by most of the Apps that I wanted to control.

I agree, that is a great tip! I didn’t really know that could be done, though now that you mention it, it sounds vaguely familiar. However, even when I looked at this panel of the System preferences it wasn’t immediately obvious to me that this was possible, but I figured it out. Here is a screenshot, I used this to add the Control-R for Help and Control-1 for Formula Workshop that Panorama 6 used to have.

It works great!! The shortcuts even show up in the menus!

John, you are right, this is a payoff of the effort to do everything as Apple standard as possible.

But this macOS feature applies to menu commands only. It won’t help Terry to get the cmd-F or cmd-S shortcut into the Find-/Select dialog.

I suspect these Apple options have been overlooked by most Mac users, but they are easy as far as they go. And pointing out how much can be done, easily, in Panorama, is important in growing its market. And that’s important so as to keeping it going for the next thirty years.

I don’t think Apple’s options let you assign hotkeys to submenus and certainly not to buttons. But I believe PanX lets you assign them in more places. I’ve spotted several hooks for such, although haven’t tried them yet. I’ve made it through the first 20 (excellent) videos, but as Custom Menus is #21 I expect to know more about this soon.

And those ‘Select Additional’ and ‘Select Within’ are very handy when using Pano 6.

As an aside, I’m not thinking we’ll ever get Command-S to Select from a Find/Select as we’ve moved to OS X as Apple does reserve that (and others) for system shortcuts. That is one that we’ll have to adopt to a new shortcut keystroke.

It doesn’t matter to me what the keyboard shortcuts are for that dialog. But not having them would seriously slow down my use of the program. I hope Jim is able to add them.