Global Variable Conflict in script
I have a complicated script which has several steps. It involves importing data from an excel sheet to a table and then distributing that data into 2 other tables within the database.
To achieve this I use global variables to carry over the data from script to script. It all works fine.
Except for some reason, if I try and run the script twice in a row, the second time the script gets stuck half-way. However if I close the file, reopen and try then, it works fine. So i'm guessing there's a conflict of some kind with the global variables.
Is there a way I can reset all variables once the script has run? As if I had closed the file and started from scratch?
Any and all info would greatly appreciated.
Put a series of Set Variable steps at the end of your script:
Set Vriable [$$GlobalVariable ; Value: "" ]
That will set the variables back to null after the script has finished.
This sounds like a script where using FileMaker advanced's Script Debugger to step through the script while watching the values in the variables change could eliminate a lot of frustration for you.