-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathvar.define.fmfn
30 lines (29 loc) · 1.2 KB
/
var.define.fmfn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
* =====================================================
* var.define( name ; value )
*
* RETURNS: (bool) True or False based on proper evaluation
* DEPENDENCIES: none
* NOTES: see var.eval for declaring multiple variables
* =====================================================
*
* This custom function is a wrapper for the
* assignment(creation) of global variables.
* Variables are tracked within $$VARIABLES
*/
Let ( $function.var.define.value = value; // preserve the data type of the inbound value
Let ( [
$$ERROR.VAR.DEFINE = ""; // Reset the global error variable for evaluation
var.dollarsign = If ( Left ( name ; 2 ) = "$$" ; "" ; "$$" ); // check for prefixed $$
var.calc = "Let ( " & var.dollarsign & name & " = $function.var.define.value; False )"
];
If (
Evaluate(
var.calc
) = "?";
Let ( $$ERROR.VAR.DEFINE = List ( "EVAL ERROR"; "-------"; var.calc ); False );
// Insert the name of the variable into the reserved $$VARIABLES global variable
Let ( $$VARIABLES = If ( IsEmpty ( FilterValues ( $$VARIABLES ; name ) ); List ( $$VARIABLES ; name ) ; $$VARIABLES ) ; True )
)
)
)