Brian Dunning's FileMaker Custom Functions

AddRemove ( value ; content )

A custom function which allows simple addition or extraction of values from a list.

  Average rating: 4.0 (41 votes) Log in to vote

Matt Petrowsky   Matt Petrowsky
ISO Productions, Inc.
http://www.filemakermagazine.com

Share on Facebook Share on Twitter

  Sample input:
AddRemove ( 4; "2¶3¶4¶5¶" )
  Sample output:
2
3
5

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function is a simple tool. It simply adds or removes a value from a return delimited list of values. The area where this is most useful is when working with portals and clicking a portal row to add or remove an ID value from a global field storing a multi-key value.

 

Comments

Willem-Jan   Willem-Jan, Hiversum
Jan 6, 2010
I have added the RightValues functions so you do not have to add an "¶" to the content parameter. To be sure the list closes with an enter.


Let (
[
content =RightValues ( ( content );ValueCount ( content ));
value_exists = PatternCount ( "¶" & content & "¶" ; "¶" & value & "¶" )
]
;
Case (

value_exists; MiddleValues ( Substitute ( "¶" & content; "¶" & value & "¶" ; "¶" ) ; 2 ; 1000000 );
content & value & "¶" )

)
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: