deDup ( )

Function stats

Average user rating
132
235
9999
Support
FileMaker 7.0 +
Date posted
04 December 2009
Last updated
04 December 2009
Version
Recursive function
Yes

Author Info
 Charlie

7 functions

Average Rating 4.7

author_avatar



 

Function overview

Prototype

deDup  ( text;   separator )


Parameters

text  The text that you would like to de-duplicate


separator  The text that separates text items


Description

Tags:  unique values   remove duplicates   deduplicate   de-duplicate  

De-duplicates text which is separated by a delimiter - e.g. you might have a value list that needs de-duplicating.

Reviewing this now - this might only work for valueLists - think you will need to change first part of Let function to deal with non-value list text... haven't tested. Will test one day & update.

Examples

Sample input

deDup( List( table::field ) ; ¶ )


Sample output

This will give you a list will all the duplicates removed

 

Function code

Let(
[
TheValue = LeftValues ( Text ; 1 ) ;
TheCount = ValueCount ( Text ) ;
NewText = Replace ( Substitute ( separator & Text & separator ; [ separator ; separator & "::::$$$::::" ] ; [ "::::$$$::::" & TheValue ; "" ] ; [ "::::$$$::::" ; "" ] ) ; 1 ; 1 ; "" )
] ;

Case ( TheCount > 0 ;
TheValue & deDup( Replace ( NewText ; Length ( NewText ) ; 1 ; "" ) ; separator )
)

)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/235

    Prototype: deDup( text; separator )
    Function Author: Charlie (http://www.fmfunctions.com/mid/132)
    Last updated: 04 December 2009
    Version: 1.1

*/
// ===================================

 

 

 

 


Login or register to comment

Create a new account with fmcustomfunctions.com or login to post a comment.

 

 

 

Top Tags

Text Parsing  (24)
List  (19)
XML  (15)
Format  (14)
Date  (14)
Debug  (12)
Layout  (11)
Variables  (10)
Filter  (9)
ValueIterator  (6)
Layout Objects  (6)
Number  (5)
Recursive  (5)
Dev  (5)
Interface  (5)
Text  (5)