One Part Harmony – FileMaker Database Design, Development, and Maintenance

Custom Functions: Value Lists & Script Parameters
Parm

Used to package multiple values to be passed to a script (script parameters) or returned from a script (script result) into a multi-value string (value list).

Format
Parm( Value )
Parameters
Value - One of (possibly) a series of values to be passed to or returned from a script.
Data Type Returned
text
Examples
Parm( “21” ) & Parm( ”Jane” ) & Parm( “Doe” ) would return 21¶Jane¶Doe¶
Description
This function concatenates multiple values into a “package” (a string) with carriage returns separating the individual values (what FileMaker calls a “value list”). The resulting string can then be passed to a script (Perform Script step) or returned by a script (Exit Script step). The complimentary functions Get_Parm and Get_Result can then be used to extract individual values from this parameter package.

This function converts carriage returns within an individual value to the pipe character (”|”), because a return will be added to the end of the value to separate it from any additional values. But before converting the carriage returns, any existing pipe characters are converted to a the STX character (ASCII 02). This way, when the parameters are unpacked, the pipe characters are translated back to carriage returns and any STX characters are translated back to pipe characters.

This may sound a bit confusing, but all it really means is you don’t have to worry about whether there are any strange characters in the value you pass the function, and you can freely use an entire value list as a single value in another value list. In both of these cases, everything just works!
FileMaker Versions Supported
10, 11, 12, 13, 14, 15, 16
Code
/*
This function is used to package parameters to be passed to or returned from a script.
*/

Substitute
(
Parameter ;

/*
pipe character that was previously converted to STX becomes ETX (supports nesting of parameter packages)
*/
[ "" ; "" ] ;

/*
because carriage returns within a single parameter are translated to pipe characters, pipe characters within a parameter are converted to the STX character
*/
[ "|" ; "" ] ;

/*
carriage returns within a single parameter are translated to the pipe character, because carriage returns are used to separate multiple parameters
*/
[ "¶" ; "|" ] ;

/*
new line character (ASCII 10) gets treated like carriage return
*/
[ Char( 10 ) ; "|" ] ;

/*
vertical tab character (ASCII 11) gets treated like carriage return
*/
[ Char( 11 ) ; "|" ] ;

/*
form feed (new page) character (ASCII 12) gets treated like carriage return
*/
[ Char( 12 ) ; "|" ]
)

/*
add a carriage return after the value to separate this parameter from any subsequent value added to this package in another call to this function
*/
& "¶"