Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Removing code because it's not needed.

...

It is ALWAYS suggested that record cloning be managed via a script within the user interface. However, using a script trigger is inherently tied into the user interface and is layout or object specific. If a lower level method of duplication support is required then the following modifications may accomodate - with caveatsthis.

In order to support FileMaker's native record duplication feature with UUIDs, a few changes just one change to the above dialog boxes must be made. The "Do not replace existing value of field (if any)" checkbox must be unchecked. The Auto-Enter calculated value would be replaced from the simple UniqueID to the following.

Code Block
titleAuto-Enter for Duplicating Record Support
Case (
	not IsEmpty ( Self ) and creationTimestamp = modificationTimestamp;
		UniqueID;

	IsEmpty ( Self );
		UniqueID;

	Self
)

As you can see, two additional fields are required and referenced. The creationTimestamp and modificationTimestamp from Field naming should be the exact same value when the record is duplicated. Given that any newly created record will not have any values pre-existing within the fields, it's the job of auto-enter to populate these fields. Using the not IsEmpty() test simply determines if the field does contain an existing value, which, in the case of a duplicate record, it will. In that case, the calculation will evaluate to a new UniqueID only when the two other referenced fields match. On record duplication these values will be initialized and should be the same at the point in time the record is cloned.

The default result for the key field must always be itself. You always want to limit your exposure to potentially invalid data. Also of note is the fact that the calculation will always evaluate any time the record is modified - by virtue of the fact that it references the modificationTimestamp field. This contributes, albeit a VERY small amount, to any performance degradation and is another vote for the script trigger based method of duplication management.

So long as no other fields are reference by this calculation, it should only generate a new UniqueID when a new record is created or duplicated. With the "Prohibit modification of value during data entry" checked, the user cannot modify the field value even if the ID field is shown and accessible (which, in most all cases, it should not be).

...

titleCaveats

...

.

UUID Options

Get ( UUID )

In version 12, FileMaker introduced the Get ( UUID ) function, which creates a unique 36-character string of mostly random hexadecimal digits according to the RFC 4122 standard. For example:

...