Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Clearing all global variables

Featured Replies

Is it possible to clear all global variables simply? Or do I have to clear each one by hand?

Is it possible to clear all global variables simply?

Yes - close the file.

You could also script it. Use the [color:red]Set Field step to clear the necessary globals.

  • 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.

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?

  • 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.

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

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 ( )

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 by Guest
Additional

  • 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

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.