-
Notifications
You must be signed in to change notification settings - Fork 16
/
requests.save.fmfn
32 lines (30 loc) · 1018 Bytes
/
requests.save.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
/*
* =====================================================
* requests.save ( layout ; request )
*
* RETURNS: (bool) True or False based on success or failure
* DEPENDENCIES: none
* NOTES:
* =====================================================
*
* Intended use is for saving a return delimited list of
* fieldname/value pairs into a global variable with the
* same name as the layout.
*
*/
Let ( [
var.requests = Evaluate ( "$$" & layout & ".requests" );
var.existing = If ( IsEmpty ( var.requests ) or var.requests = "?"; False; True );
var.saved = // The let function (as a string) to be evaluated
Evaluate(
"Let ( $$"
& layout & ".requests"
& " = " & Quote ( var.requests )
& If ( var.existing; " & \¶ & "; " & ") // add carriage return if existing content
& Quote( Substitute( request; ¶; "|" ) ) & // each request on its own line
"; False )"
)
];
// Return
If ( var.saved = "?"; False; True )
)