December 15, 20169 yr So person performs a find for part of the text they wish to find. The resulting display should bold just the part that they searched for in that field. I have tried to search for examples but don't even know what to search for. Hints would be appreciated. I think I need pattern count but that just gives me a number.
December 16, 20169 yr You can use a custom function. Here is one which will work: /* boldSelectedText ( text ; search ) purpose: bolds the search characters within a text string */ Let ( [ bolded = TextStyleAdd ( search ; Bold ) ; len = Length ( search ) ; pos = Position ( text ; search ; 1 ; 1 ) ] ; If ( Length ( text ) ; If ( pos ; Left ( text ; pos -1 ) & bolded & boldSelectedText ( Right ( text ; Length ( text ) - pos - len +1 ) ; search ) ; text ) ) ) I've attached a file which shows how it works. I am sure there are better custom functions. You would need to capture the search criteria. You can have the User enter the search string into a global field or enter find mode and then capture that value for your calculation. You could also use a script. Instead of creating a calculation in your data table, I would use a PLACEHOLDER field. I've provided a few examples. PLACEHOLDER fields are great to eliminate calculations used only for display. Keep in mind that PLACEHOLDERS 1) must remain empty and 2) will not display in preview or print. BoldSearched.fmp12
December 16, 20169 yr There are some nuances worth mentioning here. For example, the default Filemaker find looks for words that begin with the search phrase. Highlighting the search phrase as pattern is more inclusive. Say you searched for "little" and the found record contains "Doctor Doolittle belittled his little friend". Highlighting the pattern "little" will result in "Doctor Doolittle belittled his little friend" - but the first two highlighted occurrences played no part in the search.
December 19, 20169 yr Author Yep, Laretta, that is what I needed. Comment thank you also. Laretta showed that problem in demo file but I use find looking for text anywhere by surrounding with *.
December 19, 20169 yr Hi Rob, I suggest that you also check out this custom function which preserves the case (whether capitalized or not) of the search phrase. In all, it is a better custom function. Sorry I didn't find this CF before I wrote mine above. HiliteSingle ( text ; searchString ; color ) Note that you should use the CF Comment has listed further down in the link instead of the original one. And you'll need to change from highlight to bold but I'm sure you can handle that! :-)
December 19, 20169 yr I like this one by Ray Cologon here http://www.nightwingenterprises.com/demos2014/demo1309.html
Create an account or sign in to comment