Software Venture Consulting
ToMarket

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

RemoveValue ( Value ; ValueList )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 3.1  (19 votes)
  Discuss this Custom Function

Caleb Ruth, Data Performance LLC
http://www.dataperformancellc.com

A recursive function that removes all matching values from the supplied list

Sample Input:
RemoveValue ( "rabbit" ; "mouse¶jackrabbit¶rabbit¶lynx" )
Sample Output:
mouse
jackrabbit
lynx


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

This function removes all matching values from a list. Unlike other functions it does not require any padding nor adds nor removes any extra paragraph chars to the resulting list (save one at the end). Recursion limits apply to the size of the list.

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

This is my Custom Function and I want to edit it

Discuss:

There's no need for recursion for this function. This does it in a single line of code:

Substitute ( "mouse¶rabbit¶lynx¶snake" ; ["rabbit";""] ; ["¶¶";"¶"] )

F. Osman Cabi, Turkey
June 09, 2010 2:43pm

I like the non-recursive one line solution suggested in the comment above, but it may remove parts of a value, not the whole value.

Example: Substitute ( "mouse¶rabbit¶lynx¶snake¶jackrabbit" ; ["rabbit";""] ; ["¶¶";"¶"] ) results in
"mouse¶lynx¶snake¶jack"

Adding the usual "¶" at the beginning and end of the ValueList and at the beginning and end of Value helps, but there may still be leftover returns depending on what the original list looked like. Rather than reinventing the wheel for dealing with extraneous "¶", I used the excellent CullNulls CF to do the cleanup and ended up with the following:

CullNulls( Substitute ( ¶ & ValueList & ¶ ; ¶ & Value & ¶ ; ¶ ) )

Note that unlike the original function presented, using CullNulls will remove leading/trailing returns originally in ValueList, so if retaining leading/trailing returns is important, additional logic is needed.

Cynthia, USA
June 16, 2010 4:52pm

Here's an edit to the code that removes the trailing return by using the List function instead of an '& "¶"' Also converted If statements to Case statements for brevity.


/*
RemoveValue custom function by Caleb Ruth, Data Performance LLC
Edited by Carter Brooks, developer.carterbrooks.com. Converted to use List function to remove trailing return

parameters:
Value
ValueList
*/


Let ( [
the_value_count = ValueCount ( ValueList ) ;
the_existing_value = GetValue ( ValueList ; 1 )
]
;

Case (
the_value_count > 0 ;

List(
Case (
not Exact ( Value ; the_existing_value ) ;
the_existing_value
)
;
RemoveValue ( Value ; RightValues ( ValueList ; the_value_count - 1 ) )
)
)

) //let

Carter Brooks, San Francisco
January 16, 2012 7:56pm

Here's a succinct non-rescursive function that neither adds nor removes leading or trailing line returns, only removes entire values (no partial line issues). It adds its own line returns to make the substitute work, and so knows it can remove them before returning the new list:


// ValueRemove ( valueList; itemValue )
// version 1.0, Daniel A. Shockley

Let(
cleanedListPadded = Substitute( "¶" & valueList & "¶"; "¶" & itemValue & "¶"; "¶")
; Middle( cleanedListPadded; 2; Length( cleanedListPadded ) - 2 )
)

Daniel A. Shockley, New York, NY
January 27, 2012 7:20am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 4 + 3 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. CountWordOccurrences ( text ; searchWord )
  (Tue, Feb 07, 11:15am)
2. indonesian_date(date)
  (Mon, Feb 06, 7:14pm)
3. phpArrayValue ( array ; key ; pos )
  (Fri, Jan 27, 1:49pm)
4. solfm_timeToMinutes (theTime;roundSec)
  (Fri, Jan 20, 6:26am)
5. filterLines(filterField;filterValue;Result)
  (Sat, Jan 14, 2:20pm)
6. getMaxValue ( theList )
  (Thu, Jan 12, 1:06pm)
7. MiddleWordsIncPunct ( text ; startingWord ; numberOfWords )
  (Sat, Jan 07, 9:16am)
8. WindowInfo
  (Fri, Jan 06, 12:39pm)

RSS Feed of Custom Functions