Importing a Text File


Actually my 5/20 forum note covered this in detail.

When I recorded the manual procedure, and ran the recorded code, the file imported CORRECTLY. But when I ran the same code a second time, and every time thereafter, the Error Wizard window opened WITH BLANK INFORMATION. If you scroll up to the 5/20 response in this thread, you will see the blank Error Wizard window.

In fact, does that offer you a clue as to what might be happening?

Best regards.


CORRECTION - My earlier note is dated April 10.


The only suggestion I have at this point would be for you to send me a copy of the database and the text file in question. Hopefully I can reproduce the problem while running the Xcode debugger.


OK, Jim. I suppose it will be important for you to figure out what is happening. In case it happens again, you will know what to do. I, along with others, want Pan X to be as great as Pan 6. Greater!

I modified the Portfolio.txt file to contain only 2 records, with garbage data. I modified the Portfolio.pandb database to eliminate all macros and forms, except the macro “Import Data”. I left that macro untouched, but you will have to emend it to conform with whatever path you use in placing the files.

You will note there are only two commands in that macro. I comment out one or the other to choose which one runs.

The first command is the one I wrote, which works correctly in other DBs (except with different path and file names). When that command is run, I get the “file does not exist” error window.

The second command is the one the macro recorder wrote. Note that the fileload parameter is exactly the same as in the first command. I even copied and pasted the fileload(path/name) to make sure there were no typos. That command now works the first time, AND EVERY SUBSEQUENT TIME. With the original database and text file, it only worked the first time, but gives a blank Error Wizard window each succeeding time.

The critical question is: why does PAN X not recognize the fileload path/name in the first command, but does recognize it in the second? The secondary question of why the recorded macro command terminates with a blank Error Wizard window will not be able to be addressed, because with these modified files, that no longer occurs. But you did see the blank window in my Apr 10 forum note.

Now for the most important question - How do I send these file to you?


You can email them either directly to me or to support [at]

Be sure to send me a text file in addition to the database. Just compress it all into a zip file.


I received Vic’s files. I am unable to duplicate the problem. The code which Vic says does not work for him, worked perfectly for me, time after time (at least a dozen times). It never failed, even once. Of course I did have to adjust the path to a valid path on my computer.

Since you say that the code recorded by the Import wizard does work for you, I guess the best bet would be to just go with that. There is no reason not to use that code, right?


Hello Jim,

I predicted to myself that the files would work immediately for you. If they hadn’t, it would mean there was an obvious and blatant error in Pan X code, and I knew for sure you would not have released such a program.

The recorded code in my database runs the first time through, but results in a blank Error Wizard window every time thereafter. So that’s why that is not a viable solution.

However, I have a workaround.

The code below DOES NOT work, and gives the “file not found” error:

importtext binarytotext(fileload("/Users/vicdifranco/Data/Financial/
Investment Folder/Portfolio.txt")),“ExistingData”,“Replace”,
“AddFields”,“No”,“ReArrange”, “”+tab()+import()

The following code DOES work - first time, and every time. Note the fileload( function is exactly the same as before (copied and pasted):

Local myData
let myData = binarytotext(fileload("/Users/vicdifranco/Data/Financial/Investment Folder/Portfolio.txt"))
ARRAYFILTER myData, myData, ¶, “”+tab()+import()
openfile “&@myData

Apparently, Pan X is more comfortable manipulating text arrays than manipulating text files. The second macro code is not as elegant or concise as the first, but it is not unwieldy or difficult to understand.

Perhaps this simple workaround will help someone else who experiences a similar issue. At any rate, it suggests there is a subtle and non-replicable error in the importtext ReArrange option.

Many thanks to all who helped with this problem. What a great forum this is!

Best regards,


Today, I happened to see the same error message: "The file “FileName.txt” could not be opened because there is no such file."
The reason in this case: There was a typo in my formula that should build the file path to the text file; so one folder in this path was wrong.