RemoveValue ( theList ; value )
Removes the first value from a paragraph delimited list but leaves all other duplicate values in the list.
Average rating: 4.3 (36 votes) Log in to vote
Vaughan Bromfield - Show more from this author |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
RemoveValue( theList ; value )
by Vaughan Bromfield
Removes the first value from a paragraph delimited list but leaves all other duplicate values in the list. If the value is not in the list, the list is returned without modification.
Let(
[
newlist = "¶" & Substitute( theList ; "¶" ; "¶¶" ) & "¶" ;
pos = Position( newList ; "¶" & value & "¶" ; 1 ; 1 ) ;
pre = Left( newList ; pos - 1 ) ;
post = Right( newList ; Length( newList ) - ( pos + Length( value ) + 1 ) )
] ;
Case(
IsEmpty( theList ) ; "" ;
pos = 0 ; theList ;
Middle( Substitute( pre & post ; "¶¶" ; "¶" ) ; 2 ; Length( Substitute( pre & post ; "¶¶" ; "¶" ) ) - 2 )
)
)
Comments
Mauricio Rodriguez, Villa de Leyva May 2, 2016 |
||
Hello, Could this be modified to do this: Input: "1¶1¶2¶2¶1¶2" Output 1¶2¶1¶2 ?? I'm trying to do this but I'm stomped... |
||
Vaughan Bromfield May 2, 2016 |
||
What are you removing from the first list to get the output? RemoveValue( "1¶1¶2¶2¶1¶2" ; ? ) = "1¶2¶1¶2" |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.