UniqueValues ( )

Function stats

Average user rating
104
149
9999
Support
FileMaker 8.5 +
Date posted
17 December 2008
Last updated
19 December 2008
Version
Recursive function
Yes

Author Info
 Jeroen Aarts

3 functions

Average Rating 4.0

author_avatar



 

Function overview

Prototype

UniqueValues  ( array )


Parameters

array  Return separated list of values


Description

Tags:  Values, List, Duplicates  

Accepts a return separated list of values, and returns a list where duplicate values are removed, thus retaining only the unique values. The function retains only the last of found duplicates.

Examples

Sample input

UniqueValues ( "a¶b¶cbb¶b¶bcc¶a¶e" )


Sample output

cbb¶b¶bcc¶a¶e

 

Function code

/*
Returns unique values of an array

- Jeroen Aarts, ClickWorks bvba, www.clickworks.be
*/

Let([
firstVal= GetValue(array; 1);
newArray = RightValues( array ; ValueCount( array) - 1) ;
newArray = Left(newArray; Length(newArray) - 1) // for some reason FMI need to add a trailing return to the list, remove it!
] ;
Case(
ValueCount(array) ≤ 1; array ;
If( ValueCount(FilterValues(newArray ; firstVal)) ; "" ; firstVal & "¶" ) & UniqueValues( newArray )
)
)

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

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

    Prototype: UniqueValues( array )
    Function Author: Jeroen Aarts (http://www.fmfunctions.com/mid/104)
    Last updated: 19 December 2008
    Version: 1.1

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

 

 

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (32)
Date  (28)
XML  (27)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (13)
Filter  (12)
Layout Objects  (11)
Design  (10)
Array  (8)