Claris/FileMaker Pro provides a number of possible default auto-enter values for specific fields such as creation and/or modification date, time, timestamp, account name and the less used name option.
These are the suggested minimal set of fields to include for every table.
When creating a solution which is used in more than one time zone it's desirable to know when records were created or modified relative to a singular time. This can be accomplished with the Get ( CurrentTimeUTCMilliseconds )
function within an auto-enter field.
Extra milliseconds?
TheGet ( CurrentTimeUTCMilliseconds )
function does include a milliseconds portion and is a pure number. In order to use a true UTC timestamp, conversions will be required. Reasoning for not converting the value to a true timestamp varies based on requirements. Millisecond values are useful for logging purposes and mass record creation, but conversion (within the auto-enter) is optional.
The following images showcase how to add both a creation and modification based UTC timestamp. This particular field (or a converted variant) is often necessary when communicating with external APIs and disconnected systems.
Image of the createdUTC field
Note: The check box for Do not replace existing value of field (if any) is checked for the creation field but not for the modification field.
Image of the modifiedUTC field
Here's the auto-enter calculation for the modified field.
Let ( ~trigger = GetField ( "" ) ; Get ( CurrentTimeUTCMilliseconds ) )
Because of the GetField ( "" )
function, the modified value is forced to trigger anytime a given record is modified.
Host Time Stamp field
It's also possible to use the same method to add a createdHost and modifiedHost timestamp usingGet ( CurrentHostTimeStamp )
. This may be desired for easy calculation of the local time offset from the time zone where the Claris/FileMaker Server is running.
It is both possible and suggested you establish your own desired set of default fields. The collection of default fields should be added automatically to every new table created.
This can easily be accomplish by adding, and then modifying, a specific file to a known location on your local computer. Information about accomplishing this and using our preferred file as a starting point can be found here FMDefaultFields.xml.