Fileload( function fails because I don't have permission to view the file


#1

I have databases alpha and beta in the same folder. In alpha, I have a procedure which contains this command:

let BetaData = fileload("beta.pandb")

The result is:

57%20pm

Why? I get the same result whether the target file is open or not.


#2

It works fine with .txt or .rtf files as the target but not with .pandb files.


#3

That’s not really the right error message, but the result of this function should be an error – the .pandb file itself has no data to load. Panorama X files (.pandb files) are bundles, in other words, not a single file, but a collection of files in a folder that is masquerading as a file. In the Finder, you can right click on a .pandb file and choose Show Contents to see what is inside – you’ll find about a half dozen files.

So, you can’t use fileload( on a .pandb file, just as you can’t use it on a folder – because a .pandb file actually IS a folder. You can use fileload( on the individual files inside a .pandb file, like this:

let BetaData = fileload("beta.pandb/data.archive")

My next question would be – what were you planning to do with your BetaData variable? It would just be a bunch of binary nonsense, you can’t look inside and examine the data or anything else. So there really is no point to loading any of the contents of a .pandb file into a variable.


#4

I had written code to import several text files and, without thinking, just wrote the same code to import a Panorama X file. My brain then reconnected and I used the importdatabase statement. I was misled, in part, by the statement in the documentation that the fileload( function “reads the entire contents of any file on disk”.