UniqueList ( )

Function stats

Average user rating
46
151
9999
Support
FileMaker 8.0 +
Date posted
17 December 2008
Last updated
21 April 2009
Version
Recursive function
No

Author Info
 Agnès

17 functions

Average Rating 4.6

author_avatar



 

Function overview

Prototype

UniqueList  ( ListA;   CaseSensitive )


Parameters

ListA  


CaseSensitive  Optional parameters : Boolean


Description

Tags:  Unique   List  

Unique data in a list

Not recursive Function - Optional Parameters : Case Sensitiveness ( boolean format or null )


* UniqueList () requires CustomList ( start ; End ; Function )


----------------------------------------- more détails

--------- CaseSensitive = empty or 0

UniqueList ( "One¶Two¶three¶Four¶five¶ONE¶two¶four¶five¶Seven" ; "" or 0 )
-> Result = "One¶Two¶three¶Four¶five¶Seven"

--------- CaseSensitive = 1

UniqueList ( "One¶Two¶three¶Four¶five¶ONE¶two¶four¶five¶Seven" ; 1 )
-> Result = "One¶Two¶three¶Four¶five¶ONE¶two¶Seven"

Examples

Sample input

UniqueList ( "One¶Two¶three¶two¶One ; "" or 0 )
Result > One¶Two¶three
--------------------


Sample output

UniqueList ( "One¶Two¶three¶two¶One ; 1 )
Result > One¶Two¶three¶two
--------------------

 

Function code

/* UniqueList ( ListA ; CaseSensitive ) .v1_1
UniqueList () requires CustomList ( Start ; End ; Function )*/
// Optional parameters : CaseSensitive : Boolean

// UniqueList ( "One¶Two¶three¶Four¶five¶ONE¶two¶four¶five¶Seven" ; "" or 0 ) -> Result = "One¶Two¶three¶Four¶five¶Seven"
// CaseSensitive :
// UniqueList ( "One¶Two¶three¶Four¶five¶ONE¶two¶four¶five¶Seven" ; 1 ) -> Result = "One¶Two¶three¶Four¶five¶ONE¶two¶four¶Seven"

//-------------------------------------------------------------------*/
// Agnès Barouh - Septembre 2007 - Bugs / Corrections Report : barouh.agnes@wanadoo.fr
//-------------------------------------------------------------------*/

Case (
not ( CaseSensitive = 1 or ( GetAsNumber ( CaseSensitive + 0 ) = 0 ) ) ; "Incorrect CaseSensitive" ;

Let([
$Values = "" ;
$MyFirstList = ListA ;
$MyList = "|" & Substitute ( ListA ; ¶ ; "|¶|" ) & "|" ;
$Rc = ¶
];
Choose ( CaseSensitive ;

CustomList ( 1 ; ValueCount ( $MyFirstList ) ;
"Let( [
TheValue = GetValue( $MyFirstList ; [n] ) ] ;
Case ( PatternCount ( $Rc & $Values & $Rc ; $Rc & TheValue & $Rc ) < 1 ;
Let ( $Values = $Values & $Rc & TheValue ; TheValue )))" ) ;

CustomList ( 1 ; ValueCount ( $MyFirstList ) ;
"Let( [
TheValue = GetValue( $MyList ; [n] ) ;
Test = Substitute ( $Values ; TheValue ; \"X##X\" & TheValue ) ;
$Values = $Values & $Rc & TheValue ] ;
Case ( PatternCount ( Test ; \"X##X\" & TheValue ) < 1 ; GetValue( $MyFirstList ; [n] )))" )
)
)
& Let ( [ $Values = "" ; $MyFirstList = "" ; $MyList = "" ] ; "" )
)

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

    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/151

    Prototype: UniqueList( ListA; CaseSensitive )
    Function Author: Agnès (http://www.fmfunctions.com/mid/46)
    Last updated: 21 April 2009
    Version: 1.1

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

 

Comments

Andries Heylen
25 April 2015



when the list is empty, it returns a customlist error that you need to provide a numeric value,
just adding in the beginning:
Case (
isEmpty ( listA ) ; ""
... rest of code


solves the problem!
 Bug report