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
*/
// ===================================
Let(__LITBR__[__LITBR__ TheValue = LeftValues ( Text ; 1 ) ;__LITBR__ TheCount = ValueCount ( Text ) ;__LITBR__ NewText = Replace ( Substitute ( separator & Text & separator ; [ separator ; separator & "::::$$$::::" ] ; [ "::::$$$::::" & TheValue ; "" ] ; [ "::::$$$::::" ; "" ] ) ; 1 ; 1 ; "" )__LITBR__] ;__LITBR____LITBR__Case ( TheCount > 0 ;__LITBR__ TheValue & deDup( Replace ( NewText ; Length ( NewText ) ; 1 ; "" ) ; separator )__LITBR__)__LITBR____LITBR__)__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/235__LITBR____LITBR__ Prototype: deDup( text; separator )__LITBR__ Function Author: Charlie (http://www.fmfunctions.com/mid/132)__LITBR__ Last updated: 04 December 2009__LITBR__ Version: 1.1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.