Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

Hilite(SourceText; SearchText; R; G; B)

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 3.8  (52 votes)
  Discuss this Custom Function

Ray Cologon, NightWing Enterprises
http://www.nightwing.com.au/FileMaker

This function highlights all occurrences of a specified word or phrase in a block of text.

Sample Input:
Any block of text.
Sample Output:
The same block of text with formatting applied (can't show here because only plain text is accepted on this form).


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

Locating occurrences of a word or phrase within a large block of text helps users to locate items of interest. This function utilizes recursive syntax to search the source text and apply bold and colored formatting to all ocurrences of the search string (regardless of case).

Because this function modifies the form but not the content of the supplied text, it is suitable for use in an auto-entry calc which sets the field to itself - providing transparent and automatic search and highlighting functionality.

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

5 most recent comments | Show all 7 comments

Hi Doug,

I suspect the problem you are experiencing may lie somewhere else other than the custom function. I have seen it running in a number of FMP 12 solutions without incident.

Just to be sure, I just created a brand new v12 file with a couple of fields, added the CF copied pasted directly from this page and set a text field (containing about 20 lines of text) to itself multiple times, highlighting various different search terms. It worked flawlessly each time, no chugging (result was returned instantly) and no crash.

Presumably there is something in play in your case beyond the points you've mentioned. Eg how much text is in the field you're running the process on? Does it work with just a few lines in the source field - if so you may be breaching stack overflow limits (which are the same in v12 as in previous releases, FWIW).

Ray Cologon, San Diego
August 14, 2013 5:34pm

Hi,

I am using your function since years. Once in a while, however, I observed that the text in the HiLite-Field doesn't show up. Instead, a question mark appears.

Finally, I checked the reason and found out that whenever the length of the SourceText is larger then 10.000 characters the function doesn't work anymore.

Is there a possibility to change this, or do I have to split the SourceText in various portions?

Regards
Jobst Gmeiner

Jobst Gmeiner, Darmstadt/germany
June 04, 2017 12:01pm

Hi Jobst,

I have not encountered the issue you are describing.

Just to be sure, I just created a brand new file in FileMaker 16, created a couple of fields, added the CF copied pasted directly from this page and set a text field to contain a number of lines of text and a calculation to highlight search strings entered into another field. It worked flawlessly each time, regardless of the length of the SourceText I supplied (my tests included SourceText strings of over 100 characters and the function continued to work as intended).

Presumably there is something in play in your case beyond the points you've mentioned, but it's not clear from your description what that might be.

Regards,
Ray Cologon

Ray Cologon, Melbourne
June 04, 2017 1:22pm

Hi Jobst,

My apologies, I now see that I misread your message, and your reference to the SourceText is in EU number notation and you are referring to strings longer than ten thousand characters (we use a different number convention here and I'm afraid I read your message as referring to only 10 characters).

The ten thousand character limit is a result of the stack depth limit imposed on standard recursive operations by FileMaker, and this function uses standard recursion, so by its nature it is limited to input strings of ten thousand characters or less.

It would be possible to create an alternative function using tail recursion, that could process strings of up to fifty thousand characters (after which it too would fail), but that would require significantly different syntax.

Regards,
Ray

Ray Cologon, Melbourne
June 04, 2017 1:29pm

Hi Ray,

yesterday, I came back to the problem of SourceText limitation again and found your answer. Thank you and sorry for the wrong notation of the number ten thousand.

meanwhile I could circumvent the problem with a filemaker script:
Whenever I open the file with the SourceText. the script splits the SourceText into portions of 9999 characters, puts them into separated fields with the corresponding HiLite fields. Finally, the HiLite fields were combined again into one field, the hilights are preserved.

It works perfect and even fast enough with a file containing more than twenty thousend records.

Best regards,
Jobst

Jobst Gmeiner, Darmstadt/germany
June 30, 2017 8:44am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 7 + 6 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions