I have 3 local FileMaker files, some of which are related to each other as external data sources. All EDSs are established using the new global variable technique.
It would be too much (and I don't think useful) to go into how each file is related to the other, but my issue boils down to this...
I have a script in one of the files that is in charge of closing one of the other two. I can step through this script in the debugger and get a successful close one time and a failure the next. Let's say FileA is closing FileB. I do not get an error on the Close File (FileB) step but sometimes the file closes, sometimes it does not. I check status of files being open by a ShowCustomDialog step with 'Database Names'.
1. just prior to attempting to close FileB, I perform a script on FileB (from FileA). The only thing in that script is a Set Field step that blanks a global field in FileB.
2. FileB has no external data source references. FileA has a reference to FileB but nothing on the relationship graph. The reference exists only to run a script on FileB from FileA
Here are the pertinent (from what I can tell) FileA script steps:
1. SCD 'Database Names' shows that FileA is the only file open
2. Perform Script (myScript) on FileB
3. SCD 'Database Names' shows that now both FileA and FileB are open
4. Close File (FileB) ; this is always error 0 in debug
5. SCD 'Database Names' sometimes shows only FileA open (which is what I intend), sometimes both FileA and FileB
I have a feeling this must have to do with timing, but I can't figure it out. I've put waits in the script at various places and I still get varying results.
My solution is in several places going to depend on one file closing another so I really need to understand this concept as best I can.
Has anyone seen anything like this and have any advice?