File Not Open? What The ...?


#1

Jim,
I’m terribly sorry, but PanX just does not work for me. I may be unique in this, but it frustrates me at every turn.

After my recent forum query (“32 - A Bitter Pill to Swallow”), I decided to try again to convert my files to PanX. At least I thought I would learn more about the upgrade in the attempt. But I hit an immediate problem.

My code: (p1 and f2 are previously defined)
opendatabase p1 +“Macros:Various Macros.pandb”
FARCALL “Various Macros.pandb”, «myOpenFile», f2

The result: an error message on the farcall line stating that it could not be completed because “Various Macros.pandb is not open”.

But it certainly IS open. There it is on my screen. It opened at the first line of code. The Pan6 version of this database works flawlessly, and has done for many years.

I don’t know what it is about me, but PanX seems to thwart me every opportunity. I just can’t get “into” it. And the absence of single-step debugging is an added frustration.

There may be a simple explanation for why the above code results in that error, but really, that is besides the point. Writing simple code similar to past code should not be an adventure.

I will have to put panX aside again to await a future release. It looks like a great program, and I’m sure it will be a great program. But not yet.

Vic


#2

The name of an open database does not include the extension. Try

FARCALL “Various Macros”, «myOpenFile», f2

#3

Thank you, Dave. Yes, that works.

Vic


#4

In Panorama 6, the equivalent to the code you submitted above would be.

opendatabase p1 +"Macros:Various Macros.pan"
farcall "Various Macros.pan",«myOpenFile»,f2

But this code will not work in Panorama 6. Instead, you would see the error message “Call to undefined procedure”. At least Panorama X gives a better error message.

I’m going to guess that in Panorama 6 you weren’t using the .pan extension, so that your code really looked like this:

opendatabase p1 +"Macros:Various Macros"
farcall "Various Macros",«myOpenFile»,f2

That code will work in Panorama 6. And guess what – that code will ALSO work in Panorama X, with absolutely no modifications. When dealing with a database name, Panorama automatically adds the file extension when needed (either .pan in Panorama 6, or .pandb in Panorama X).

I’ll bet that you converted this database to Panorama X, and looked and this code, didn’t try it, and figured it had to be fixed. But it didn’t need fixing! Panorama X already did the right thing.

This has always been the rule, both in Panorama 6 and Panorama X. And I still recommend this. Even though in this case the file name is Various Macros.pandb, the database name is Various Macros. So that is what you should use whenever you reference this database. The only exception would be if you are referencing the database as a file, not as a database – for example if you were using the filetrash statement to delete the file. In that case, you are deleting the file, not the database. So you must include the .pandb extension in the filetrash statement.

I think this rule is pretty clear, but I know that not everyone finds the distinction between database and file clear, sometimes folks get confused. So I just made a change to Panorama so that statements like farcall don’t care if you include the .pandb or not. If it is included, the farcall statement will now ignore it (or will after the next release). This goes for pretty much any statement or function that references a database in memory – dbinfo(, getfieldproperties, setactivedatabase, farcall, call(, etc. So when the next version of Panorama X comes out, this statement will work:

farcall "Various Macros.pandb",«myOpenFile»,f2

I still recommend that you follow the rule of NOT including the .pandb extension when referencing a database, but if you forget, Panorama X will now reference the correct database anyway.


#5

Hello Jim,

You are correct. My original code did not include the .pan extension, because I never used the extension in my Pan6 file names. Here I was thinking myself clever to remember the .pandb extension in the OPENDATABASE command and the FARCALL command. It’s a good idea of yours to eliminate this un-necessary requirement.

As I re-read my original note, it may have come across more negatively than I intended. That must have been the temporary frustration I was feeling at the time.

Perhaps I will continue my conversion attempts from Pan6 to PanX. After all, there are several indian guides around (Dave, Gary, you, et al) to keep us all from straying too far off the right path.

I hope you get the server version addition done soon. When that important milestone is reached, you will have more time to spend on the less-critical, but still important issues of concern to others of us.

By the way, Jim, I’m not giving up on colorized records in the datasheet. I intend to bug you about it from time to time. Politely, of course.

Regards,
Vic