This technique isn’t a lifesaver, but it could be. People have been asking and I will be showing have already shown it to the NY FileMaker Pro User Group, so here it comes in a nutshell for all the other users and developers: It’s a global field in the header part of a layout, and it performs a scripted search when the user presses Enter or exits the field.Wow!
Huh?
What This Is
A solution to the problem of finding data in FileMaker. A couple of months ago, Jeff Cohen of Blue Engine Solutions enlightened me to the fact that my users were getting in to Find Mode but not realizing it. Meaning, they couldn’t easily differentiate the different modes in FileMaker and often ended up nearly logging out and logging back in just to return to their starting point. Ultimately, this would usually result in a support phone call or some kind of panic attack on the part of the client and me having to re-acquaint the user with how to go back to Browse Mode or to click the button that would help the system return to data entry mode. As the deployment of my solution grew, the same kind of panic was being shared by many users. Thankfully, several other developers concurred that this is a problem they deal with often and was not exclusive to my design and database functionality. This is my solution, and it is one that I think once users wrap their head around in FileMaker, they will elaborate upon with all sorts of new whiz bang features and I can’t wait to see what people come up with.
What This Is Not
First off, I think alot of users might be looking for a way to include a search in FileMaker in the Spotlight search currently available in Mac OS X “Tiger”. For example, say you have a document management system, built in FileMaker 7, that stores JPEGS, Word, PowerPoint, Excel spreadsheets, etc. in a container field. I think many users are looking for a way to type in a Spotlight Query and also have Spotlight search the documents stored in the FileMaker database. This technique does not do that. Sorry, but it just doesn’t. I may have a quasi/almost-good/half-baked idea/workaround if that’s what you really need. I’m also working on this and I’ll keep you posted on the results.
The Solution
As that greyed box said earlier, this technique is simply a field placed in the header part of a FileMaker 7 layout that executes a script when data is entered into the field. (It’s important to note that this is only available to version 7 users. The basis for some of this functionality is not available in version 6, but there is a slight workaround – see the end of this article.) Simply put, this lets FileMaker do even more of the technical thinking and working for database users when they are querying for data, much like how a search engine like Google can determine if you are looking up an address, phone number, website, document, image, or a product to buy. We start, by creating a calculation field, which returns text, that compiles all the data we want to be easily searchable into one field. So, if we were designing this in an inventory system and wanted users to be able to search for items by a brand, descriptive text, price, and discount percentage we would create a calculation field called Search Index. The calculation would be:
Search Index =
Brand & ” ” & Description & ” ” & Price & ” ” & Discount
Next we create a global text field in a new table. I created a special Globals table which should have NO RECORDS. The table will still technically hold data but it should only have Global fields. The reason for this is that if there is a record in the said table, the script execution will occur with the wrong search query i.e. it will always be the previous search query and not the current one (this has something to do with the act of ‘committing data’ and even if the Commit Records script step is used, the script will not execute properly… go figure). See the thumbnail for the proper basic set up of this technique.
From there, the path to completing the setup for this technique is simple and straightforward. On any of the layouts you wish to use the Spotlight search technique, place the search entry field from the Globals table. In the case of my diagram, it’s the field entitled “Search Entry”. Put that global field on the top of whatever layout you plan on searching from and then change the Auto-Enter options to process a script (with an auto-enter calculation that says something like “Case(not IsEmpty(Search Entry); XMpl_StartScript(Get(FileName); “SearchScript”))” assuming your search script is named “SearchScript”). Specifically the search script should do the following:
- Commit records
- Enter Find Mode
- Set the Search Index field to the value of the Spotlight search field (called Text in the case of the diagram)
- Perform Find
… and go to whatever results layout you want or pop open a new window or do whatever. else you like.
The end result is you remove the necessity of having your user to break down a search query into its component parts. You could even build some natural language syntax processing and simplify FileMaker’s search prowess for new or less technically inclined users. For example, you could have users search a clothing inventory system by entering the query “sold items from 9/1/2005 to 9/10/2005 without jeans” and then break the query down to:
- Find Request #1
- Sold Checkbox: [x]
- Date sold: “9/1/2005…9/10/2005″
- Duplication Find Request #1
- Find Request #2
- Sold Checkbox: [x]
- Date sold: “9/1/2005…9/10/2005″
- Omit Records: [x]
- Item Description: “jeans”
Conclusion
I haven’t really finished the full presentation of this technique and I’ll be posting the example files shortly. I know many people emailed about when this technique would finally be brought to light and here is my first iteration at discussing it. I hope you find it useful and please pass along ideas and enhancements. In the meantime, watch out for the example files I’ll be providing.
Source from: www.secretweaponlabs.com
Recent Comments