Archive for February, 2008

2008 FileMaker Developers Conference

Thursday, February 21st, 2008

FileMaker Developer Conference 2008

The 2008 FileMaker Developers Conference has been announced by FileMaker Inc. It will run 13-17 July at the JW Marriott Desert Ridge Resort & Spa in Phoenix, Arizona. This venue has great facilities including the obligatory lazy river where all the business get done!

This year, David Head will be presenting a workshop - Developing for Understanding: Self-Documenting Custom Functions. This sessions starts by looking at examples of good and bad expressions written in the FileMaker Pro calculation engine. It then moves on to look at the use of custom functions to produce better functions that more clearly express the intent in an expression. Participants will receive a list of useful custom functions they can incorporate into each and every solution they create.

The conference schedule reveals a wealth of incredibly useful stuff about FileMaker. If you can make it to Devcon 2008, you won't be sorry.

Tracking changes to a single field

Thursday, February 7th, 2008
When creating a new table, it is often thought good practice to include fields to store the record creation and record modification timestamps (date and time). These fields are timestamp fields with the field option to automatically enter the Creation Timestamp or the Modification Timestamp. You would also check the option to "Prohibit modification of value during data entry" to protect the data from change.

Timestamp auto-enter modification

Developer Quiz Question
Where is the Creation or Modification Timestamp drawn from? What is the potential problem with this? (Check the answer at the end of this article)

The problem with the modification timestamp is that it records when the record was last modified. That is, when any field was edited, even if that field was edited and changed straight back without committing the change.

So the question is how do we track when any single field has been changed? An example may be that we want to track when a status field was last modified. If the status was changed from 'interested' to 'enrolled', we would like to know when it was changed (and possibly by whom).

There is a simple technique that uses the Evaluate function. The Evaluate function evaluates an expression as a calculation with optional fields to trigger the calculation to update. For example,

Evaluate ( "Get ( CurrentHostTimeStamp )" ; Status )

Notice that the expression is represented as a text string (in quotes). Note also that we have supplied one field name as a trigger. This means that every time the Status field is changed, the expression will be evaluated and the current value returned to the field.

So where do we put this? In this case, we could set up a timestamp field named Status_LastModified and then set an auto-enter calculated value that would be the expression above.

Timestamp auto-enter calculation

It is important that we uncheck the 'Do not replace existing field value (if any)' checkbox so that the calculation will update. Having set this, any change to the Status field will prompt an update of the timestamp in the Status_LastModified field.

Notice also that we are extracting the timestamp from the host (perhaps a FileMaker Server) and not the client. This ensures better consistency of timestamps where the client time may be incorrect or where clients are in different time zones.

So how do we record the person who changed the status? Here we are assuming that all users log in to the database with their own account and password (considered best practice in security). Therefore, we can set up another text field called Status_LastModifiedBy and using an auto-entered calculation:

Evaluate ( "Get ( AccountName )" ; Status )

Finally, if you don't need the modification data in separate fields, you could set up a single text field that uses an auto-entered calculation:

Evaluate ( "GetAsText ( Get ( CurrentHostTimeStamp ) ) & \" \" & Get ( AccountName )" ; Status )

If you extend this technique further, you can also record the data entered in the field and you are well on your way to setting up an audit trail on a field.

Developer Quiz Answer
The date and time for the record creation or modification is drawn from the time set on the client computer. This means that the either timestamp can be 'wrong' if the client computer date and time is incorrect (whether by accident or design).

The creation timestamp can be drawn from the database host (say the FileMaker Server) by using an auto-entered calculation:

Get ( CurrentHostTimeStamp )

This is also important if you want to standardise time entry between clients existing in different time zones.

There is not a similar simple solution for the modification timestamp apart from setting up a modification field as described above with all fields as triggers. However, the modification timestamp is of more use to show how long a record has remained unmodified rather than when it was last modified.

FileMaker Server 9.0v3 Updater

Wednesday, February 6th, 2008
Available now for download:

FileMaker Server and Server Advanced 9.0v3 for Leopard (OS X 10.5.x)
FileMaker Server and Server Advanced 9.0v3 for Tiger (OS X 10.4.x)
FileMaker Server and Server Advanced 9.0v3 for Windows

This welcome update includes a lot of bug fixes including compatibility between FileMaker Server and Leopard.

To download, go to the downloads page on the FileMaker web site. Please read the installation instructions on the web site carefully as they apply to your current server and FileMaker Server installation.