Get time of last sync for Pack sync table

A couple of related questions:

  • Any way to determine that last sync time?
  • Any way to force a sync using a button?

I’m not aware of a way to force a sync with a button (but agree it would be nice!)

For determining the last sync time, are you trying to access that from within the pack code, or from within the Coda doc?

In theory you could include a column in your sync table and put Date.now() in there for every row. It’s hacky and may have performance implications (cause you may be updating rows that don’t otherwise need to be updated), but it’s something haha.

@Nick_HE is correct, it’s currently not possible to trigger a sync via a button or automation. Syncing happens on the defined schedule for that table (at most hourly) or when a user manually clicks the Sync now button on the sync table.

The last sync time isn’t available to the sync formula as metadata, but it’s an interesting topic. What use do you have for that metadata?

@Eric_Koleda in our workflow we make changes in Coda that we push to an external source.

We use deltas between the Coda state and the synctable state to determine when a change has been made that needs to be pushed.

  • First I wanted to be able to cause a sync whenever I do a push so that the delta would always be accurately determined.
  • Then I thought that I could record a pushDateTime and would just suppress the “there’s a difference detected” notification unless there was a recorded syncDateTime after the pushDateTime
  • Since that wasn’t an option, I just settled on suppressing delta notifications for 1 hour after the pushDateTime

Response codes are OK for identifying errors and failures, but don’t really help us in this case.

I think I understand your workflow, an approximation of two-way sync. You can record the time of the sync in the schema itself, just by creating a field called syncDateTime and populating it with new Date(). The sync formula won’t have access to the last time the sync happened, but each record in the sync table can record when it was captured. Does that help?

Yes, that’s a great suggestion, thanks. Row-level will do the trick.