My.ADVISOR.com Sign-In
Username
Password
Sign Up 
Go to Article
Advanced Search 

ADVISOR TIPS

Create a Modification Host Timestamp in FileMaker Pro

Learn how to auto-enter the modification timestamp from the host when a user modifies any field on a record.

By John Mark Osborne, Database Pros president and owner, and FileMaker Advisor technical editor

UNLOCKED -- This article is provided to subscribers of FILEMAKER ADVISOR or DATABASED ADVISOR or FILEMAKER ADVISOR. To subscribe or renew, go to Advisor Store.

The Get(CurrentHostTimestamp) function introduced in FileMaker Pro 7 works great for auto-entering the host's timestamp on newly created records. The standard auto-enter timestamp on record creation enters the timestamp from the guest computer, which could be incorrect. For consistency of timestamps across records, it's better to use the timestamp from the host computer.

To auto-enter the creation timestamp from the host, all you have to do is specify an auto-enter calculation on a Timestamp field referencing the Get(CurrentHostTimestamp) function. It's that simple. However, it's a little more difficult if you want to auto-enter the modification timestamp from the host because you want the timestamp to update when the user modifies any field on the record.

One solution is to use the Evaluate function. The Evaluate function calculates the first or expression parameter as if it were a formula. For instance, you could type a calculation formula into a field and feed the field to the expression parameter of the Evaluate function. However, it's the optional second parameter that's important in this scenario. The second parameter lets you specify one or more fields to trigger the Evaluate function to recalculate. So, you could specify all fields in your table as in the formula:

Evaluate(Quote(Get(CurrentHostTimestamp)); [Field1; Field2; Field3])

The Quote function is required because you're entering the value directly into the first parameter of the Evaluate function. Specifying a field reference wouldn't require the Quote function because FileMaker Pro already interprets it as text. When you type the formula directly into the expression parameter, you must enclose it in quotes for the Evaluate function to interpret as text rather than a formula.

The only problem with the above formula is the need to update it every time you add a field to your table. A better solution is to create a new time field (Time_Mod) that auto-enters the modification time. With this new field, the above formula changes to:

Evaluate(Quote(Get(CurrentHostTimestamp)); Time_Mod)

The Time_Mod field updates whenever users modify any field and triggers the auto-enter calculation on the timestamp to reevaluate. Don't forget to deselect the auto-enter option on the timestamp field to "do not replace existing value of field (if any)" so the auto-enter can overwrite the timestamp whenever a user modifies a record.

Create a Modification Host Timestamp

No reader comments ... yet.

    What do YOU think about this topic? Share your advice and thoughts using this form.

    Your Name

    REQUIRED : PUBLIC

    Your E-Mail

    REQUIRED : PRIVATE

    Job, Company

    OPTIONAL : PUBLIC

    City, State, Country

    OPTIONAL : PUBLIC

    Your Web Site

    OPTIONAL : PUBLIC

    Your Comment

    Please help everyone by keeping your comments on-topic, using clean language, and not defaming or making personal attacks.


    Your e-mail address is required, but it will not be displayed to the public or given to anyone. See our Privacy Policy. Comments become visible after they pass our spam filter, and spammers and abusers are permanently blocked. Please report spam or abuse.

    John OsborneTechnical editor John Mark Osborne is president and owner of Database Pros, offering FileMaker resources on the Internet. He is author of Scriptology, a speaker at FileMaker Developer Conferences and Macworld conferences, and a trainer for the Professional Training series created by FileMaker, Inc. http://www.databasepros.com jmo@filemakerpros.com

    Printer-friendly
    page layout

    Keyword Tags: FileMaker, FileMaker Development, FileMaker FileMaker Pro

    ADVISORAMA
    A gentleman is a man who can play the accordian but doesn't.

    ARTICLE INFO

    FileMaker Advisor

    Web Edition: 2008 Week 17, Doc #19448

    Print Edition: June/July 2008, Page 60

    SUBSCRIBER ONLY ARTICLE LOCKED

    Subscribe to FileMaker Advisor Magazine

    Read the advanced guide to creating custom business database solutions with FileMaker software. Subscribe now to gain access to all the archives and downloads.

    FileMaker.Advisor.com

    Subscribe to Advisor Basics of FileMaker Pro

    Learn the fundamentals of using FileMaker Pro software. Every issue gives you step-by-step instructions on creating the databases you need. Subscribe now!

    FileMaker.AdvisorBasics.com

    Secrets Of The Top Experts -- Now!

    See exactly how to do it, step-by-step, in Advisor Academy CDs created by the top experts. Click to see what you can learn right now.

    AdvisorAcademy.com

    Free E-Newsletters

    Keep up! Hot News, How-To, Tips & Tricks, Expert Advice, and more. Click to request your's free.

    AdvisorUpdate.info

    Need Know-How Now?

    What direction are you going with your business? Advisor Guides are packed with the answers you need to work smarter. Can you afford to fall behind?

    AdvisorStore.com

    Showcase Your Smarts

    Submit your tips, techniques and advice and let Advisor promote your business and build your career. Show the world what you know!

    AdvisorTips.com

    Use of this or any other site, content, product or service of Advisor Media constitutes acceptance of Terms of Use.
    Portions copyright ©1983-2008 Advisor Media, Inc. All Rights Reserved.
    Reuse or reproduction of any portion or quantity of Advisor Media's copyrighted content, in any form, for any purpose, requires written permission.
    ADVISOR®, the ADVISOR logo, and other names and logos that incorporate ADVISOR are registered trademarks, trademarks or service marks of Advisor Media, Inc. in the United States and/or other countries.
    Other trademarks are used for identification, editorial or descriptive purposes and are the property of their owners.
    osboj039-02 posted 04/21/2008 modified 05/12/2008 03:44:56 AM ztfmfd/ztfmfd
    domino-144.advisor.com my.advisor.com 05/16/2008 12:18:05 PM