You need three fields in your local tables for RESTfmSync to function :
- A unique ID field. Named "ID" in our sample file, this uses the Get ( UUID ) function to have a value that is unique regardless of context.
- A modified timestamp field. Called "ModifiedUTC" in the sample file, this is a number field with an Auto Enter calculation.
- A sync timestamp field. Called "SyncUTC" in the sample file, this is a number field.
The unique ID
If you're using the delete functionality of RESTfmSync, this MUST be a unique value. If not, it could be just a unique auto enter serial field, but we recommend the UUID regardless.
This a number field with an Auto Enter calculation. The calculation should be set to replace the existing value:
This calc uses the GetField function to trigger an update when any other field is modified. You want this field to change whenever a record is modified, EXCEPT when it's the RESTfmSync process that is doing the modifications. The global variable is set as part of the sync process so that this field won't change during sync operations.
This is a plain number field, with no auto enter calculation. On the sync client end, this field is set manually when records are modified via the sync process, and doesn't need to be altered for normal record modification. This field is not the same as the server side "SyncUTC" field, and this field is excluded from the sync process. On the local client, it's local sync time, on the server, it's the server sync time.
You can use the combination of the Mod and Sync UTC fields to create a comparison field that checks if the Mod > Sync. In other words this will tell you if the record needs to be synced. This can be useful in the UI to display a note that sync needs to be done.