April 19, 200916 yr Is it possible to clear all global variables simply? Or do I have to clear each one by hand?
April 20, 200916 yr You could also script it. Use the [color:red]Set Field step to clear the necessary globals.
April 20, 200916 yr Author Re: closing the file, that's not really an option as I want to clear the globals and keep using the file. I've ended up clearing all the global variables by hand in one script; this wasn't too difficult. Weird how FM doesn't have a script step to do this automatically.
April 20, 200916 yr No offense, but the weird part here is your request. The very purpose of global variables is to persist until the file is closed. If you don't want them to hang around, why make them global in the first place?
April 20, 200916 yr Author None taken! It is a bit of a weird request. I'm trying to get round some hacky bits of my project where I've used globals and not unset them properly.
April 20, 200916 yr The elegance is, elsewhere than the US to use as less $ due to trade deficits ...joke aside, though wide scoped measures as global fields as well as variables should be dosed virtuously which means with hesitation: http://en.wikipedia.org/wiki/Global_variable ...so by nad large a bad habit! --sd
April 20, 200916 yr I agree with Michael here regarding global variables. That being said, perhaps you may want to take a look at these custom functions and see if you may benefit from adapting their methods. VariablesLog ( ) VariablesResetAll ( )
April 20, 200916 yr Can you explain why you need to clear these fields (or variables)? [color:red]Additional. Sorry, I didn't see your post where you state that you made errors in setting them. These now sound like normal fields with Global Storage? How many fields are involved? Have you read the Manual or checked out the Online Help on Globals Read about The Replace Function Loop Scripts Set Field Script Step Lee Edited April 20, 200916 yr by Guest Additional
April 20, 200916 yr Author Thanks Lee, and everyone else who commented. I've now realised how and where to use Global variables in FM and will do so properly in my next project. For my current project (already beyond deadline) the custom functions will be really useful. I just need to clear everything down at certain points so that I know stray global variables aren't going to cause bugs. Thanks once again!
Create an account or sign in to comment