Thank you for visiting the FileMaker Thoughts blog. I recently moved this content over from my blogger account. Hope you like it! When you get a chance, check out the centralized search feature for all the FileMaker blogs found along the right side panel. It is quite handy!


Monday
Apr142014

FileMaker OnObjectKeystroke Script Trigger Explored

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

The OnObjectKeystroke script trigger is quickly becoming one of the favorite choices of FileMaker developers wanting to strut their FileMaker geek kung fu. This in turn is starting an avalanche of really compelling user interface design techniques that are taking the FileMaker community by storm.

What the OnObjectKeystroke script trigger allows the developer to do is, perform a script when keyboard or Input Method Editor (IME) input is detected within a layout object (most likely a field). The OnObjectKeystroke trigger can be fired within any layout object that can accept Keyboard Focus. The primary target of the OnObjectKeystroke will be fields but they can be assigned to buttons, tab panels, portals and web viewers. Although the OnObjectKeystroke can be applied to a portal or web viewer object, you are not going to be able to get the OnObjectKeystroke script trigger to fire.

We should also mention there is a layout based cousin to the OnObjectKeystroke trigger called OnLayoutKeystroke.

There are so many great techniques flying around these days, it is hard to pin down who the credit for which one of them should go to. I will say the first implementation I had seen that had me sit up in my seat was by John Mark Osborne in the online FileMaker training library by VTC.com (http://www.vtc.com/products/FileMaker-Pro-10-Advanced-Tutorials.htm). This is a technique that allows you to have a field that returns a found set of records as you type. It is in the Event Driven Scripting section of the Advanced tutorial series.

PLAN YOUR TRIGGER AND TRIGGER YOUR PLAN
Now we should also mention that keyboard triggers are nothing new to computer users in general. The operating system of your computer, applications and other processes have been using them all the time. So your keyboard combination to fire a trigger might be the same as one used by your operating system, another system resource or FileMaker itself and all of these may have priority over your OnObjectKeystroke settings. So be sure to test your trigger implementations diligently.

INTERESTING LEFTOVERS
The OnObjectKeystroke trigger is what is called a Pre-Event Script Trigger. Pre-Event triggers have an important advantage over Post-Event triggers in that they can have a cancel action available to the developer within them.

When used properly, the calculation engine function Get (TriggerKeystroke) function can capture what keyboard entry was used to fire an associated OnObjectKeystroke script trigger.
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2009 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.

Sunday
Apr132014

Dangers Of The FileMaker Find / Replace Feature

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

The Find And Replace feature that was introduced with version of FileMaker 6 can have a downside. I don’t want to be dramatic but I remember when I had seen it introduced at a FileMaker developer meeting in Seattle, I was shocked more by the dangers than the benefits.


Used wisely, it’s not a bad feature but it could prompt a late night call to a developer about data loss ... and ... most professional database developers take this very seriously. When this feature is available to a user, they can mass edit a text field in very subtle ways. A user can misunderstand the find and replace dialog box (and if they do misunderstand it), they can cause a lot of harm to the integrity of a FileMaker data set.

Restoration of damaged data via the misuse of the Find / Replace command is not impossible but can be very difficult. In particular the longer the amount of time before the problem is detected / reported, the more difficult the restoration task can be for the developer.

You can effectively turn the Find / Replace feature off by setting a users menu privileges to “None” for their password. This of course turns off many other features of FileMaker as well. Developers using FileMaker Advanced can create custom menus that simply do not show this (or any other potentially dangerous) menu command.

All in all, the Find / Replace feature isn’t bad and for some users, it might be considered heaven sent. The placement of the feature can lead to some problems. This raises the bar in building solutions that are tightly locked down via security settings and solid scripting. A solid backup strategy is always a good idea and perhaps more so in light of this feature.

Now you may be thinking that the Replace and Relookup commands can also be used to mass edit data. They can also be used improperly and harm the integrity of a FileMaker data set. However, the relookup and replace commands are not part of a find operation. So many users ignore the Relookup and Replace commands. In fact, I’d say that most users don’t even know about the Replace command (and in some cases Replace can be downright handy).
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2008 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.

Sunday
Apr132014

The FileMaker Find / Replace Command

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

** Personally, this command scares the daylights out of me for basic user access. I will post a "Dangers Of" article a little later. Exercise great control when working with this feature. ***

The find / replace command feature was added when FileMaker 6 rolled out. The feature can be found under the FileMaker 9 Edit menu and as a pair of script steps. Find / Replace allows you to find a string of text in one or more fields and replace it. A classic example could be when a company changes names after a merger. You want to find any reference to ABC Company in a number of fields and change it to the new name of XYZ Company.

Here is the dialog box for the Find/Replace feature when accessed from the Edit menu.

You have quite a few options with the find / replace command feature. You can start your search in a forward direction, a backward direction or all directions. That is to say if you choose forward and you are on record six, the find / replace will only function on records above record six. The reverse is true for backward. All directions will cover all records in the found set, regardless of the record you are on. The other options include ...

Match Case - Means that you are only looking for matching words with matching capitalization.

Match Whole Words Only - First this means that you have to have a whole word match. So FileMaker will not see a match with words that are within words. For example you could search for the word “file ”. In your found set you may have records with “file” and some with “FileMaker”. Whole word search will only find whole and complete word matches ( in this case, the word “file”).

Also Match Whole Words Only deals with strings bound by a word break. So you may also search for a sequence of words with a blank space or some other acceptable punctuation character. This means that you “file” specific search would see a match between file and file.com.

Search Across - This can mean something different based upon what mode ( browse, find or layout ) you are in when you activate the search. In Browse mode it can be used to search across just the current record or across all records in the found set. In find mode, it can actually search and replace text in your search request. Now that could lend to some very interesting scripting! In layout mode, you can search and replace text on the current layout.

Search Within - This means you can do a search / replace for just one specified field or for all the fields on the current layout.

Also have 4 different buttons you can click to activate the search / replace in 4 different ways. They are ...

Find Next ( goes to the next found match )

Replace & Find ( replaces the next match, then moves to find the next match )

Replace ( goes to the next found match and replaces )

Replace All ( replaces all matches )

The default setting for Find / Replace is for all records and all fields.

NOTE: A new feature / wrinkle regarding Find / Replace was added to the FileMaker 6.0.4 update!

Find/Replace menu command is now disabled in the Edit menu if menu access is limited by the current password or if a script is paused.

If the Status Area is hidden and locked in Form View, then Find/Replace menu command will be available only for the current record.

You may have noticed that I keep mentioning the Find / Replace menu command but haven’t spoken much about the related script steps. There are two script steps associated with this feature. The first is the Open Find / Replace script ( Open Menu Items family ). This script step is somewhat unimpressive. Basically, it does the same as using the menu command. It bring up the find / replace dialog box and is likely used in situations where FileMaker is running under Kiosk mode.

The second method of performing the Find / Replace script action is the Find / Replace script step. This step is found under the Editing family of script steps and can be performed with or without a dialog box.

So users running FileMaker 6.0v4 will have a different experience using Find / Replace than users of earlier versions. If the status area along the left side of the FileMaker screen is hidden and locked, then Find / Replace only works on the current record ( when executed from the menu or via the Open Find / Replace script step ). When you think about it, it makes a lot of sense. When the status area is hidden, the developer takes care of the record to record navigation. Without this tweak, the Find / Replace could be used to jump to another record outside of the developers built in navigation used when the status area is hidden. The same tweak is also now true for sorting and spell checking script steps.

For global find / replace actions for when the status area is hidden, use the Perform Find / Replace script step. It doesn’t change the way it works based upon the status area being seen or hidden. The Perform Find / Replace script step operates the same regardless of the status area setting. Find / Replace script step is also unaffected by menu access password restrictions.

You can also script toggle the status area if you want to have a user to be able to use the Open Find / Replace menu script command globally. I would think it would be easier to simply use the Perform Find / Replace script step but I thought it might be worth mentioning.

Also we should mention how Find / Replace works within Record Level Access settings. Just like how a user cannot manually change data in a field due to a record level access setting, their execution of Find / Replace won’t allow them to change that data either.

=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2008 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.

Sunday
Apr132014

Import Records And FileMaker Script Breakage

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

Many of us love the copy and paste script feature in FileMaker Advanced but it isn’t always fool proof. In most cases, if the pasted script has problems, you can quickly see it within the script. However, that isn’t necessarily the case with the Import Records script step.

When you paste a script from one file to the next, if FileMaker doesn’t see a layout, field, sub script, etc... that it needs, you will generally see an [unknown] tag somewhere. However, if a field is missing from an import order, it can throw off a portion of or your entire import order in the script. You don’t see this on the surface glance of the script, so it can appear to be just fine.

I have heard it mentioned that adding new fields or deleting fields in the source table can affect your import field mapping process as well. So the advice of testing all imported or pasted script steps holds particularly true if the scripts themselves have the Import script step within them.
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2008 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.

Sunday
Apr132014

FileMaker Custom Function - Name On Email

From Dwayne Wright PMP, PMI-ACP, CSM
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

This is a ruthlessly simple custom function that I made one evening to help myself out with a little example file I was working on. The example uses a script to pull emails that come from basics accounts such as accounting@dwaynewright.com, sales@dwaynewright.com, support@dwaynewright.com, management@dwaynewright.com and it@dwaynewright.com. I needed to extract the text in front of the “@” symbol to return accounting, sales, support, management and it (sans the @dwaynewright.com).

Since this example file is going to be moved into a number of files that I’m creating, I wanted to make it as portable as possible. So I went on a custom function hunt and didn’t find anything I needed. The needs are very basic. Look for the “@” symbol and get everything in front of it. The calculation is ...

Left ( address ; Position ( address ; "@" ; 1 ; 1 )-1)

Address is the name of the field that contains the the email address.


=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2008 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.