Custom Functions: Value Lists & Script Parameters
Get_Value
Extracts a single parameter value -- by position -- from a supplied return-delimited value list or from a parameter package created with the Parm function.
Format Get_Value( Value_List , Number ) |
Parameters Value_List - The value list or parameter package. Number - The position (sequence number) of the desired value within the list or package. |
Data Type Returned text |
Examples Assume the variable $List contains High¶Medium¶Low Get_Value( $List , 3 ) returns Low Assume the variable $Color_Scheme contains Red|Green|Blue¶Cyan|Yellow|Magenta|Black Get_Value( $Color_Scheme , 1 ) returns Red¶Green¶Blue |
Description This function is used to extract an individual value from a standard return-delimited value list. After extracting the specified value, any pipe characters are converted back to carriage returns to handle the case where an entire value list was placed into a single value in the specified value list (e.g. a “nested” value list) (a) by using pipe characters to separate values in the first value list or (b) where the first value list was assembled 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 a single parameter value -- by position -- from a standard return-delimited value list or a parameter list that was originally packaged using the Parm function. */ Let ( [ Value = Substitute ( /* extract the raw value */ MiddleValues( Value_List ; Number ; 1 ) ; /* carriage returns within a single parameter were translated to pipe characters, because carriage returns are used to separate multiple parameters */ [ "|" ; "¶" ] ; /* pipe characters within a single parameter were converted to STX character */ [ "" ; "|" ] ; /* pipe character that was previously converted to ETX gets restored to STX */ [ "" ; "" ] ) ] ; If( Right( Value ; 1 ) = "¶" ; Left( Value ; Length( Value ) - 1 ) ; Value ) ) |