Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Variable.Set

Stores a named variable that can be retrieved later using Variable.Get.

Component Version macOS Windows Linux Server iOS SDK
Variable 1.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Variable.Set"; Name; Value )   More

(old name: FM.VariableSet)

Parameters

Parameter Description Example
Name the name of the variable
Value the value to assign to the variable

Description

Stores a named variable that can be retrieved later using Variable.Get.
Unlike the variables that were introduced in FileMaker 8 these variables are not limited to the File or Script. In other words they can be retrieved from any file in the system regardless of where they were declared. All values are stored in their native data types (up to version 4.4 only text).

Use Variable.Clear to clear the variables or Variable.ClearAll to clear them all. Variable.List returns list of all defined variables.

On server, variables are shared by all users connected to the same server and will persist between sessions. So, for example, all Web Direct users will have the same set of global variables set via the plugin. You can optionally prefix variables with a user ID/Name to make them per-user unique. Variables will stay in memory until explicitly released; or the process quits. If you'd like to share data between multiple processes (e.g. Web Direct, Data API and Server Scripting), please use the SharedMemory functions like SharedMemory.SetValue.

Examples

Set a variable

MBS( "Variable.Set" ; "myVar"; "Hello" )

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 16th April 2025


Variable.Reset - Variable.ValueCount