-
Notifications
You must be signed in to change notification settings - Fork 16
/
vars.objects.fmfn
37 lines (35 loc) · 1.42 KB
/
vars.objects.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
31
32
33
34
35
36
37
/*
* =====================================================
* vars.objects( objects )
*
* RETURNS: (string) Return delimted list of valid variable declarations
* DEPENDENCIES: none
* NOTES: To be used with var.eval. Designed to have a list
* of object names passed so it can create a list of variables
* using object for the key and the object's contents for value.
* Should be used within context because of GetLayoutObjectAttribute()
* =====================================================
*
* This is useful for an interface which uses global fields as keys
* for relationships. You can call this function, pass in object names
* for global fields and have a valid varible structure created for
* you - ready to save.
*
*/
Let ( [
var.current = GetValue ( objects ; 1 ); // topmost value
var.remainder = RightValues ( objects ; ValueCount( objects ) - 1 );
var.return = "$" & var.current & " = " & Quote ( GetLayoutObjectAttribute ( var.current ; "content" ) ); // return string
$function.vars.objects.result = List ( var.return ; $function.vars.objects.result ) // append return string to collection
];
Case (
isempty ( objects ) ; "No objects found";
var.remainder > 1 ; vars.objects( var.remainder );
$function.vars.objects.result
)
)
/*
Because *Values functions leave
trailing return you use > 1 for
moving to next item in stack
*/