Brian Dunning's FileMaker Custom Functions

VariableInitialize ( name ; initialValue )

Creates a Global, or Local, variable with the value specified AND logs it's instantiation to a centralized variable log

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

Jonathan Mickelson   Jonathan Mickelson - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
VariableInitialize ( "$$TestVar"; 73 )
  Sample output:
$$TestVar = 73
AND
$$GlobalVarList =
$$GlobalVarList|0
$$TestVar|73

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

Requires FileMaker 8 or higher.

Creates a Global, or Local, variable with the value specified AND logs it's instantiation to a centralized variable log, in another tracking global. This tracking global, "$$GlobalVarList", becomes a single centralized location to track and manage variables for the file.

The Data Viewer in FileMaker Advanced can easily be instructed to expose the central tracking global "$$GlobalVarList" thus allowing the developer to view all variables used, or intended to be used, in the file.

A best practice *may* be to use this function to instantiate all variables in a single spot, preferebly an Open Script, rather than at time of need.

Its is possible for local variables to exist outside a script, but their scope is nuanced when they do. If a Local variable (single $) is specified with this custom function it's behavior will follow local variable rules, thus it may behave differently if instantiated within a script or without, as well as return different values with or without, depending .

NOTE: another CF named "VariableDestroyAll" can be used to remove all global variables using the variable log found in "$$GlobalVarList".

 

Comments

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: