Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How can a text field in a tab control be searched?

Featured Replies

Hello,

I have a layout with about a dozen tab controls, each dealing with a different FileMaker subject matter. In each tab, there is a text field intended to store notes about FM. I’d like to be able to do a search for specific words in each of these text fields and, if the word is found, I’d like it to be highlighted. Is this feasible? Or should I take a different approach for storing these notes and being able to search them?

Thanks.

A tab control is a tool for dividing the layout real estate into different areas of interest. For example, in a layout of a People table you can use different panels for personal information (e.g. name and address), education details, work history and so on. All these areas contain information about the same person. There would be little or no reason to select the "Education" panel  after you have searched for "Harvard". 

I am not sure exactly what kind of data your solution stores, but it sounds like you should be using separate records instead of tab panels.

 

 

Edited by comment

8 hours ago, The Learner said:

Hello,

I have a layout with about a dozen tab controls, each dealing with a different FileMaker subject matter. In each tab, there is a text field intended to store notes about FM. I’d like to be able to do a search for specific words in each of these text fields and, if the word is found, I’d like it to be highlighted. Is this feasible? Or should I take a different approach for storing these notes and being able to search them?

Thanks.

I have seen something similar a long time ago implemented in FM. It's not functionality FM supports out of the box though. From memory, you would have to read the note field into memory, search it, then replace the words you're interested in with the same word but now wrapped in a highlighted background (TextStyleAdd ( text ; HighlightYellow ) ) and write the full text back into the note.

The thing to remember with this is that you'll have to undo this every time. Alternatively, you could use a separate table for this with throwaway records/fields that get used once only, and which are overlaid over the normal note field. If there are multiple notes to search through, and you also want other (normal) text fields to be searched, it gets messy very quickly.

In that case you'd probably want to use a temporary record (using global fields)  that has all the fields the normal record has and duplicate everything before showing the data on the layout. You can then use a save button to save any altered data. But you'd first have to clean the data of any highlighted text.

 

Apparently I have misread the question. If you want to highlight certain words within a field (regardless of the field being in a tab control panel or not), you can use a calculation field with a custom function such as https://www.briandunning.com/cf/579.

  • Author

Than you both for your comments.

In fact, my original question may have been a bit misleading. As Comment wrote, the issue is not about the text field being in a tab control or not; it's about whether or not a text field can be searched and found words highlighted.

The approach described by OlgerDiekstra is way too complicated for me as I am far from an expert on FM. As for the link provided by Comment, it refers to a function called HiliteMulti. It looks like this function is no longer present in FM, at least I can't find it in my FM16 version. Was the function ever present in FM and removed, or is it still present under a different name, or maybe it's only in FM 17 or 18?

Whatever the case, I was hoping that a simple text field in FM could be searched and the found word highlighted, the same way a text in Word format can be searched. If it cannot be done, storing notes about my solution in the solution itself is not very appealing.

I'll be quite happy to look into other suggestions if any.

Thanks again.

You have to import (or copy/paste) and set up custom functions manually.  FM doesn't come with custom functions installed.

  • Author

Thanks Steve,

But it seems like FM16 doesn't allow me to do this? Is that correct? 

You need the Advanced version of Filemaker in order to add a custom function to your solution (once added, it can be used by any version). In the absence of a custom function, you can use a looping script to populate a global field. Or, if you are willing to severely limit the number of phrases that need to be highlighted, you may be able to use a "regular" calculation to perform the task (a custom function can be recursive, so it can handle up to 50,000 phrases).

Note that regardless of the method you choose, you will need to use 2 fields: one for the original note, and one for showing the text of the original note with the highlights applied to it. You can layer the fields so that users will see the highlighted text, but enter the original note field when they choose to edit the contents. The suggestion to replace the original text with the highlighted version is unacceptable, because (1) it would not allow each user to highlight their own phrases, and (2) it would trigger unnecessary modifications of the record thus causing any LastModified fields you may have to become useless.

 

Edited by comment

  • Author

Thanks a lot for your explanations. I'll try to use the looping script approach for now, until I upgrade to the latest FM version. Being retired, I can afford devoting a few months to writing a script, even if chances are I'll never get it right.😃😃 At my age, I've learned to be patient.

You can use the two custom functions - HiliteMulti and its prerequisite HiliteSingle - as the roadmap for your script. It shouldn't take more than an hour or two to get it right. Post again if you get stuck.

 

Edited by comment

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.