Left or right statement followed by save causes .Initialize to fail

In a database which contains nothing other than this .Initialize statement and which is included in my “Open at login” list:

try
    field C
    left
    save
    message "Success"
catch
    message ".Initialize failed"
endtry

I get the .Initialize failed message. If I remove either the left or save statement I get the Success message. This is reminiscent of the closefile followed by save problem which I raised some years back and which Jim fixed.

Can somebody else test this for me to see if it’s a bug - it’s possible that the problem is caused by some other item in the “Open at login” list.

Screen Shot 2020-06-14 at 5.34.45 pm

Whether it’s a bug or not, don’t put a save statement in the .Initialize procedure. Obviously there is no point in saving – the database is by definition not modified at that point, it just got loaded into memory.

I would sometimes think this might be of value when you are delivering a table to others and you want to know if they have opened the files when they were asked not to. ie. In a timed testing situation during a training class. Or when you save the answers to a test that the user is supposed to open the file ‘after’ they have submitted their test so that they can check their submitted values. To check the integrity of ’tested’ users. With the mindset of security, lots of creative uses. Name a file ‘Do not open this file’ can tempt many. Can you trust this person?

That would probably be an incentive for me to copy the file to a different location and open it just to see why I wasn’t suppose to open it in the first place. But then, I’m too curious for my own good most of the time.

Not in this case which is a hyper-simple example but I have .Init procedures that assign values to variables and set up multiple databases in a particular way (like closing all unwanted windows, sorting, etc.) and I certainly want to save those results.

I’d still like to know if it’s a bug or something on my computer. Could somebody try it?

I took you at your word and tried your code. It worked as it should have. Then to test a little farther I added a line to the code as follows:

    field C
    left
    B="changed"
    save
    message "Success"
catch
    message "Failure"
endtry

just to make sure it was really saving. It was, and worked again without problems. So I guess it may be something in your system. I’m running OSX 10.15.5 and PanX 10.1.2.

Hi Michael,
Your code also worked correctly when I tried it. And when I added Bill’s modification.

Thanks Bill and Tom - I’ll do a little more digging.