Brian Dunning's FileMaker Custom Functions

toggle_value_in_value_list ( vList, theValue )

Allows you to toggle ADD/REMOVE a single value TO/FROM a targeted ValueList.

  Be the first to rate this function Log in to vote

Don Wieland   Don Wieland - Show more from this author
DW Data Concepts
http://dwdataconcepts.com

Share on Facebook Share on Twitter

  Sample input:
toggle_value_in_VL ( List("aaa";"bbb";"aaa";"ccc";"ddd";"ddd") ; "aaa" )
  Sample output:
bbb¶ccc¶ddd¶ddd

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

Allows you to toggle ADD/REMOVE a single value TO/FROM a targeted ValueList.

Found a few functions in this library that kinda do this, but left trailing hard returns and did not deal with multiple occurrences of the value.

 

Comments

Richard DeShong   Richard DeShong, Logic Tools
Feb 12, 2024
Hello Don, you said you saw my CF ListToggle(), but it did not do what you needed, so you created this one. You asked for my feedback.
1) When I use your sample data, I get the exact same result with ListToggle().
2) This has a heavier memory load since you assign parameter variables to local variables.
3) Use of While() with Replace() seems to perform the same function as Substitute().
4) Use this function is 1% slower than ListToggle() using your sample data (6 values), and 10% slower with 30 values.
5) I think that if both parameters are empty, this function returns a ¶ (vertical tab).
 

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: