Brian Dunning's FileMaker Custom Functions

AddRemoveListItems ( theList ; thevalues )

Add or remove item from list, also remove empty lines

  Average rating: 4.3 (36 votes) Log in to vote

Bruce Robertson   Bruce Robertson - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
AddRemoveListItems( "¶a¶¶¶¶¶¶7¶6¶¶B¶¶"; "x")
  Sample output:
a
7
6
B
x

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

AddRemoveListItems (theList; theValues)
Adapted from function by: David Head, uLearnIT
theList: standard return separated list
theValues: text

This function will add an item to a list if it does not already exist; otherwise the item is removed from the list

Always removes empty lines from list, including leading/trailing returns

Simply remove empty lines from list:
AddRemoveListItems ( theList; "")

Recursive: theValues can be a list of values, each will be processed in sequence.

 

Comments

Orhan   Orhan, Munich
Nov 5, 2013
Hi,

can you change it for me please generate the list instead this form

a
7
6
B
x

in this please: a, 7, 6, B, x...

also in Horizontal form with ", " seperated

thanks so mutch
obi5500@gmail.com
 
Jens Rasmussen   Jens Rasmussen, Copenhagen, Denmark, Europe
Dec 12, 2013
To do that, simply write this calculation:
newResult =
Substitute ( originalResult ; "¶" ; ", " )

Regards,
Jens
 
karmjit   karmjit, perth, WA
Dec 9, 2014
I'm using this function so that the user selects values (from within a portal) and i build a list from the selected. I then use the above function to add or remove this list from an existing list. I have found that if the user selects the last value in the portal, it doesn't work even though i have a valid list. I simply get a ? displayed.
 

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 15 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:

Under construction. Email me your wish list for improvements.