In Filemaker, Setting a variable is very easy. you can do that by using SetVariable () which accepts two parameters Variable name and value. if you need to set a global variable with Dynamic name then you can achieve it with a custom function.
Allows the user to set dynamic global vars without having to explicitly script a named variable. So you can have a single line script set variable [$var] pass the parameters and create a global var on the fly or destroy it bypassing the name with no value.
Here, Let Function is setting an expression which will set variable later after getting evaluated. before evaluation, we are replacing the marker with a variable name to achieve a dynamic global variable
Let ( [ $var1 = "\"Let ( [$$##MARKER## = " & value & "] ; $var1 )\""; $var2 = Substitute ( $var1 ; ["##MARKER##" ; variable] ) ] ; Evaluate (Evaluate ( $var2 )) )
DynamicVar ( "test"; "100" )
$$test = 100