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

Custom Functions: Value Lists & Script Parameters
Remove_Value

Removes a value in the specified position, along with the associated delimiting return character, from a value list, effectively shortening the list by 1 value.

To replace or clear an existing value, use the
Update_Value function.

Format
Remove_Value( Value_List , Index )
Parameters
Value_List - The existing value list.
Index - The position of the value to be removed from the existing value list.
Data Type Returned
Text
Examples
RemoveValue( “ab¶cd¶ef¶gh¶ij¶” , 4 ) returns “ab¶cd¶ef¶ij¶”
Description
if the Index specified is zero or is greater than the number of values in the existing value list, the Value_List if returned unaltered.

If the
Index specified is less than the number of values in the existing Value_List, the value in the specified position in the existing value list is removed, along with the delimiting return character, effectively shortening the list by 1 value.
FileMaker Versions Supported
7, 8, 8.5, 9, 10, 11, 12, 13, 14, 15, 16
Code
/*
This function removes a value in the specified position and the associated delimiting return character from a value list, effectively shortening the list by 1 value.
*/

Let
(
[

/*
count the items currently in the value list
*/
Value Count = ValueCount( Value_List ) ;

/*
remove any trailing return at the end of the value list, so we know its safe to add one later (eliminates dup returns)
*/
Value_List = Clean_Trailing( Value_List )

] ;

Case
(
Index < 1 ; Value_List & "¶" ;
Index > Value Count ; Value_List & "¶" ;
If( Index > 1 ; Clean_Trailing( LeftValues( Value_List ; Index - 1 ) ) & "¶" ; "" ) & If( Index < Value Count ; Clean_Trailing( RightValues( Value_List ; Value Count - Index ) ) & "¶" ; "" )
)

)