HighlightOccurrence ( )

Function stats

Average user rating
5.0000
67
138
9999
Support
FileMaker 7.0 +
Date posted
13 December 2008
Last updated
13 December 2008
Version
Recursive function
Yes

Author Info
 Maarten Witberg

1 functions

Average Rating 5.0

author_avatar



 

Function overview

Prototype

HighlightOccurrence  ( ListToTest;   ListToCompare;   ColorMatch;   ColorNoMatch )


Parameters

ListToTest  


ListToCompare  


ColorMatch  


ColorNoMatch  


Description

Tags:  highlight, text occurrence, list  

- This function will recursively color code values in ListToTest by determining if they occur in ListToCompare
- Input format for ListToTest and ListToCompare : ¶ -delimited values;
- Two color parameters allow the user to select a highlight color for either or both matching and non-matching values
-contact me: witbe001 - at - planet.nl

created and tested using ver. 9

Examples

Sample input

HighlightOccurrence ( "apple¶pear¶banana " ; "kumquat¶banana¶guave" ; RGB ( 200 ; 0 ; 0 ) ; 0 )


Sample output

"apple¶pear¶banana" with the value "banana" in red

 

Function code

//HighlightOccurrence ( ListToTest ; ListToCompare ; ColorMatch ; ColorNoMatch )
//by maarten witberg 2008

Let(
[
text = ListToTest ;
first = LeftValues ( text ; 1 ) ;
next =
Case
(
not PatternCount ( ListToCompare & ¶ ; first ) ;
TextColor ( first ; ColorNoMatch ) ;
TextColor ( first ; ColorMatch )
) ;
text = RightValues ( text ; ValueCount (text ) - 1 )
];
next &
Case
(
not IsEmpty ( text ) ;
HighlightOccurrence ( text ; ListToCompare ; ColorMatch ; ColorNoMatch )
)
) // end let

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

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

    Prototype: HighlightOccurrence( ListToTest; ListToCompare; ColorMatch; ColorNoMatch )
    Function Author: Maarten Witberg (http://www.fmfunctions.com/mid/67)
    Last updated: 13 December 2008
    Version: 1.1

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

 

 

 

 

 

 

 

Top Tags

Text Parsing  (31)
Date  (26)
List  (26)
Format  (23)
XML  (22)
Sql  (18)
Dev  (18)
Debug  (15)
Interface  (13)
Text  (13)
Layout  (13)
Variables  (12)
Filter  (11)
Design  (10)
Layout Objects  (8)
Timestamp  (7)