What high-level problem are you trying to solve?
Prevent/warn of out of date form definitions being used due to not manually syncing or being online when automatic sync is attempted.
Even with reminders to sync before starting, I have had enumerators power up devices while out of connectivity and commence work, submitting duplicate / incorrect records, either due to forgetfulness or assuming someone else did it.
Any ideas on how ODK could help you solve it?
While an offline device can't know if the definition is the latest version, the form screen does show the 'Added on' datetime value, but it doesn't change to last 'attempted' sync, only updating with a change received.
Is there another 'last sync' datetime value for the form somewhere that could be accessed by the form, so that a warning note or unpassable question could be made revelant if now()-'last sync' is over x hours/days? This would then force the user to sync before continuing.
I have a partial solution using existing functionality for this. Thanks @Xiphware for the key to the version.
You can access the form version via /*[1]/@version
If you set the version field in your form as an excel calculation that formats the current datetime properly, you can extract the date from it and compare this to today and if the delta is greater than your threshold, either block progress if you know the form is updated every x days, or warn that the form is x days old, have you synced recently.
There's no way to know if there are newer versions or if a sync has been successfully attempted in the last x days, but it's a small step forward. Not tested in Webforms, not tested in Collect, there might be some funky format issues that require conversion to decimal date time etc to guarantee it works everywhere all the time
EG, for the warning case:
XLSXForm settings version as =TEXT(NOW(), "yyyy-mm-ddThh:mm:ss")
a calculate ${formdate} as substring-before(/*[1]/@version,'T')
a calculate ${daysold} as int((${start}-${formdate}))
a note ${oldformwarning} "This form version is over 30 days old, have you synced for updates recently?" with relevance as ${daysold}>30
That's saying "from all the toplevel nodes, get the first one, then get the version attribute". The primary instance for forms generated by pyxform is always /data/ so if that more general expression doesn't work somewhere, you can use /data/@version.