Brian Dunning's FileMaker Custom Functions

VariableDestroyAll

When used in conjunction with

  Average rating: 4.4 (30 votes) Log in to vote

Jonathan Mickelson   Jonathan Mickelson - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
If $$GlobalVarList =

$$GlobalVarList|0
$$testVar|34
$$AgeTemp|7
  Sample output:
The following variables have been set to Null (""):

$$GlobalVarList
$$testVar
$$AgeTemp

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Requires FileMaker 8 or higher.

Removes all global variables listed in $$GlobalVarList, including $$GlobalVarList. If used properly, this can insure a file has no Global variables in use any more.

NOTE: Should be used in conjunction with the CF "VariableInitialize ( name ; initialValue )", which maintains a list of all variables initialized in a file in another variable named $$GlobalVarList.

 

Comments

Rich   Rich, Lewiston, ID, USA
May 22, 2017
Forgive my ignorance, but I'm scratching my brain raw figuring out how to implement this (and its companion) custom function.

Let's say there are three global variables ($$_Alpha, $$_Bravo, $$_Charlie) that I want to null in a script using this technique. How do I set it up, not knowing what the variable's contents are (since they'll change as a loop function is called)?

TIA for your help.
 
Jonathan Mickelson   Jonathan Mickelson
May 22, 2017
This function only removes variables it knows about because their names live in a variable called $$GlobalVarList... Which is what the other companion function does, it creates the variable and logs it to that variable.

You could easily write a function that takes a list of variable names, as teext, and clears them all in one fell swoop. It would either be recursive, or substitute the evalates clearing similar to my functions.

A great custom funtiin is CustomList, Google it. It's tremendous, and does it's majic non recursively!!

Good luck!!!
 
L. Allen Poole   L. Allen Poole, Creative Database Solutions NW
Jan 21, 2021
https://community.claris.com/en/s/idea/0870H000000kAwKQAU/detail
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: