preload
0 Comments | Mar 11, 2009

New Functions in FileMaker 10

Estimated Time To Read This: 5 – 8 minutes      


It seems only logical that new functions are necessary for new functionality, so knowing what new functions you have at your disposal (and how to use them) is key to mastering the new functionality that becomes available with the dawn of any new release of FileMaker Pro. In this article, I’ll be discussing the various new functions that you’ll have in your arsenal with this newest release of FileMaker Pro 10.

One of the new enhancements to FileMaker 10 that can potentially have the most impact on your development and workflow is the new Script Triggering capability. While I won’t go into depth on triggers, it is important for you to be aware of the fact that FileMaker 10 now allows for scripts to be triggered upon the occurrence of various actions such as the press of a keystroke. Many of the new functions added to FileMaker 10 are designed to help you take advantage of this.

Code (text)
Accepts one text parameter, and will return Unicode points that represent the text that was passed as a parameter. There are a couple of things you should take note of when using this function though. The text that you pass to this function can consist of more than one character, and when it does, the resultant output from this function seems almost reversed in that the right-most digits in its output will represent the left-most character in the text parameter you passed to it. Also, each character passed to this function will be represented by a 5-digit numerical output. Zeroes will be truncated from this output wherever they are not necessary. Examples of this include when only one character is passed (“a” will return 97 instead of 00097). If multiple characters exist within your text parameter, only the last digit in the text can be truncated in the output. The output is limited by the same size restrictions that apply to number fields in FileMaker.

Char (Number)
‘Char’ is essentially the reverse of the ‘Code’ function. While ‘Code’ takes a text input, and returns Unicode points as its output, ‘Char’ accepts Unicode points for its parameter, and will return the character(s) that the points you passed represent. Some characters have multiple ways of being represented. In the example given by FileMaker Pro’s Help, ä can be represented either with Char (228), which is a precomposed character, or with Char (77600097). In the latter example, we’re passing both the Unicode points for the letter “a“ (00097) as well as the Unicode points for the dieresis mark (00776). It is worthy to note that leading zeroes are not needed for this function to work properly. This means that this function will work well in conjunction with the new Code () function. Something else to take into consideration while using this function is that the Unicode implementation on the Windows build of FileMaker outputs Char (77600097) as 2 characters, whereas the Mac implementation of it outputs the single character.

Get (DocumentsPathListing)
This function takes no parameters, and will spit out a list of all of the files contained within the corresponding folder and its subfolders. This would be the “My Documents” folder on the Windows Platform, or the “Documents” folder on a Mac. This could come in very handy for testing (perhaps in combination with ‘PatternCount’) to make sure that a file that you are importing from or to exists before proceeding with the rest of the script.

Get (TriggerKeystroke)
Simply put, this will return the character(s) that initiated a script trigger. In most cases, it will be called somewhere within a script that is designed to be triggered by an OnObjectKeystroke or OnLayoutKeystroke script trigger. For those of you familiar with FileMaker’s functions, you’ll probably find that this one will most often be used in the same types of conditions as those that you would use Get (ScriptParameter).

Get (TriggerModifierKeys)
This function works in tandem with Get (TriggerKeystroke), and will let you know which (if any) modifier keys were held down at the time when a script trigger was initiated. It does so by using the same type of output as Get (ActiveModifierKeys). In FileMaker 10, this result is a sum of the following values:

Shift = 1
Caps Lock = 2
Ctrl (Windows) and Control (Mac OS) = 4
Alt (Windows) and Option (Mac OS) = 8
Command (Mac OS) = 16

GetFieldName (Field)
Along with the all the new functionality that has been added to FileMaker 10 comes the script step “Set Field by Name” which will allow you to provide a calculation that decides which field you will be modifying. This is a very valuable addition. However, one problem that could arise from this is the fact that many will be inclined to hard-code field names into their calculations that pick the field to modify. If one of these fields should be renamed at any point in time, this would mean that your scripts with the new “Set Field by Name” steps would break. This scenario can be avoided, if you make use of this new GetFieldName () function. It will return the fully qualified name (tableOccurrenceName::fieldName) of the field you specify as the function’s parameter. Since when using this function, you will be referencing field names, instead of hard-coding field names as literal strings, these references will in turn automatically update if the field name itself gets renamed.

In summary, these newly added functions are a welcome addition to FileMaker Pro. Not only do they expand upon the software’s capabilities, they also complement the new feature set that FileMaker Pro offers. Some of them such as GetFieldName () could be used in ways that will help developers avoid having to hardcode context into scripts. What this means in the long run, is that it could potentially help to shorten development time, which in turn translates into lower costs, by allowing for the re-use of scripts between projects / modules.

Matthew Leering


Tags:, , ,





Related Articles


Leave a Reply

* Required
** Your Email is never shared