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

Custom Functions: Value Lists & Script Parameters
Get_Result

Used to extract individual values from a mutli-value string (value list) returned by a script (script result), where the Parm function was used to package the individual vales.

Format
Get_Result( Number )
Parameters
Number - The sequence number of the returned value to be extracted.
Data Type Returned
text
Examples
If a script returned a result like this:
Exit Script[Result: Parm(“21”) & Parm(“Jane”) & Parm(“Doe”)]

Use this code to retrieve the 3 returned values:
Set Variable[$CustomerNumber; Value:Get_Result(1)]
Set Variable[$CustomerFirstName; Value:Get_Result(2)]
Set Variable[$CustomerLastName; Value:Get_Result(3)]
Description
This function is used to extract an individual value from a result “package” created with the Parm function.

After extracting the specified value, any pipe characters are converted to back carriage returns to handle the case where an entire value list was placed into a single value in the script result value list using the
Parm function.
FileMaker Versions Supported
7, 8, 8.5, 9, 10, 11, 12, 13, 14, 15, 16
Code
/*
This function is used to extract individual values returned by a script (script result), where multiple values were packaged using the Parm function.
*/

Clean_Trailing
(

Substitute
(
MiddleValues( Get( ScriptResult ) ; Number ; 1 ) ;

/*
any carriage returns within a single value were translated to the pipe character by the Parm function (because carriage returns are used to separate multiple values), so change them back
*/
[ "|" ; "¶" ] ;

/*
any pipe characters within a single value were converted to the STX character by the Parm function, so change them back
*/
[ "" ; "|" ] ;

/*
any STX characters within a single value were converted to the ETX character, so change them back
*/
[ "" ; "" ]
)

)