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!


Wednesday
Apr162014

Copying A Found Set Of FileMaker Records

From Dwayne Wright PMP
Certified FileMaker Developer

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

Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit or other formatting of the posting may fail. For the best experience, please visit the journal directly by clicking (here).

Many of the FileMaker faithful do not know that you can copy an entire set of records to the computers clipboard. The Copy All Records script step will copy all the data for all the fields on the current layout. It will be stored in tab delimited format, which is to say the data for each field is separated by a TAB and each record by a carriage return. The resulting information can then be pasted into other programs such as word processing, spreadsheets and even emails!

PLEASE NOTE: The script step will copy all the fields on the current layout when the script step is executed. If you only want a particular collection of field data, it might be a good idea to have a dedicated layout for the fields you want to copy. You can have your script go to the dedicated layout, execute the copy all records command and then go back to the original layout.


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.

Monday
Apr142014

FileMaker Example: Saving Found Sets Of Data

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

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

This example can be used to save a found set of records for easy retrieval. It doesn’t save the find settings. So if new records are added that would meet the original find, they won’t show up when restored. However, there are times this method might work out well ( legacy / archive databases for example ).

In our example, we have 3 fields, one for grades, schools and teachers. There is a small down button to the right of each field to bring up a value list. These down arrows are helpful when you go into find mode. They can reduce the possibility of no records found being returned. We have 3 normal buttons to go into find mode, perform a find and to have all records show up in the found set. We do have a button that will save the found set. Clicking it will bring up the FileMaker 6 custom dialog box to enter in a name for the found set. We did add some error checking so that you cannot use the same name twice or have the name field being empty. We also have a restore found set area. Here you can pick the name of a saved found set, click the button and the previously saved found set is restored.

The Save Found Set script routine has a few twists and turns. We start off by using the new Show Custom Dialog script step introduced with FileMaker 6. For users with earlier versions, you could do the same by taking the user to a layout looking like a dialog box or by purchasing a dialog box plug-in utility. We put error checking capabilities as it's own script. This doesn't do a lot for you but it's possible you want to use the error checking in other scripts. The error checking first looks to see if the name you want to give the found set is already taken. We use the PatternCount function to detect this and the design function of ValueListItems. Our second error checking is in the form of a sequential if statement. We simply test to see if the global used to give the found set is empty ( which wouldn't do us any good at all ). Next we go to a layout that lists the unique record id field for the found set. We run the copy all records script step. Now we have a carriage return delimited list of all the record ids in the computers memory. Next we go to a layout that has a portal to our set_data file. The portal allows us to create new records on the fly. Here we paste in our record ids and set name in the last row of the portal ( again creating a new related record ). The record id data will actually be the parent key data in the set_data file when we do the restore script.

The restore found set script starts by going to the related file in the sets file. We use the name of the set as our relationship. Then we run a script in the set file that goes to the related records in the main file ... using the key field data we pasted in during the save found set scripts. This data is a multiple line key field using carriage returns between the key field values.

An example file can be downloaded by clicking (here).
=
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.

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.