Page 1 of 1

Timestamp issue in GoZync 5 Breaks $gz_LastTimeZync

PostPosted: Thu Jan 22, 2015 6:43 pm
by TheBridge
I have been experiencing a perplexing issue with GoZync 5 in which filtered hosted records were being pulled down even though they had not been modified since the last sync.

I stepped through the sync, keeping an eye on $gz_LastTimeZync and $$gz_LastTimeZync and discovered that, at some point, this variable returned a ? result. Which meant that the "Get IDS Needed For Sync PSOS" script in the hosted file was finding all filtered records whose gz_ModTimeStamp value was greater than "?", i.e. all of them.

The problem was that the gz_LastTimeZync value was being converted into quoted text in the GoZyncMobile script, "-- Get Filtered List Of IDs via PSOS". The format of the timestamp is different than the format on my machine, so when it was converted back into a timestamp in the Get IDs Needed script, the result was a ?.

The solution is to explicitly pass the year, month, day, hour, minute and second of the last sync time as a script parameter instead of a timestamp as a whole, then reconstruct the timestamp at the other end using those values.

In GoZyncMobile:
"-- Get Filtered List Of IDs via PSOS" script:
Change "Set Variable [ $TOData...]" to
Code: Select all
List(

$relatedTOData ;
"$TOName=" & Quote( $TOName) & ";" ;
"$gz_LastTimeZyncYear=" & Year($$gz_LastTimeZync) & ";"  ;
"$gz_LastTimeZyncMonth=" & Month($$gz_LastTimeZync) & ";"  ;
"$gz_LastTimeZyncDay=" & Day($$gz_LastTimeZync) & ";"  ;
"$gz_LastTimeZyncHour=" & Hour($$gz_LastTimeZync) & ";"  ;
"$gz_LastTimeZyncMinute=" & Minute($$gz_LastTimeZync) & ";"  ;
"$gz_LastTimeZyncSeconds=" & Seconds($$gz_LastTimeZync) & ";"
 
)


In the hosted file:
"Get IDS Needed For Sync PSOS" script:
Change "Set Variable [ $gz_LastTimeZync...]" to
Code: Select all
Let ( [

   dat = Date ( $gz_LastTimeZyncMonth ; $gz_LastTimeZyncDay ; $gz_LastTimeZyncYear ) ;
   tim = Time ( $gz_LastTimeZyncHour ; $gz_LastTimeZyncMinute ; $gz_LastTimeZyncSeconds )

] ;

   Timestamp ( dat ; tim )

)


I'm sure that this issue hasn't affected everyone, and it's probable that there's a more elegant or better solution. In any case I hope this helps someone who keeps syncing all unmodified records and can't figure out why. :)

Peter

Re: Timestamp issue in GoZync 5 Breaks $gz_LastTimeZync

PostPosted: Thu Jan 22, 2015 6:58 pm
by jeffalmquist
I think the problem is due to a date-format incompatibility. Clone the GoZyncMobile file, then try syncing again. Let me know if that does the trick. -Jeff

Re: Timestamp issue in GoZync 5 Breaks $gz_LastTimeZync

PostPosted: Thu Jan 22, 2015 7:30 pm
by TheBridge
Thanks very much for your quick reply.

I reverted the scripts back to their original state and then cloned the GoZyncMobile file as you suggest. The sync now works as expected. Certainly a much more elegant solution than mine. :)

I guess my question now is: how will other users be affected by this? Has cloning the file fixed the date-format incompatibility for all users, or do I have to clone the file for other users to set the GoZyncMobile file to their date format?

Re: Timestamp issue in GoZync 5 Breaks $gz_LastTimeZync

PostPosted: Thu Jan 22, 2015 7:35 pm
by jeffalmquist
A FileMaker file takes on the date format settings of the computer it's created on, or the first time it's opened after being cloned. GoZyncMobile was created with the U.S. date format. I'm guessing you're in a country that uses a different format?

Re: Timestamp issue in GoZync 5 Breaks $gz_LastTimeZync

PostPosted: Fri Jan 23, 2015 4:44 am
by TheBridge
Hi,

I use a custom date format -- yyyy mm dd -- for legibility/clarity purposes across my OS. Given that there's no guarantee that other users have the same date format as I do, what is the best solution for a properly working sync across all systems?

I'm not sure why my solution didn't work.


Peter

Re: Timestamp issue in GoZync 5 Breaks $gz_LastTimeZync

PostPosted: Fri Jan 23, 2015 2:44 pm
by TheBridge
Further to this, we've tested on multiple remote systems and it looks like it's pulling the correct records. Thanks very much!

Re: Timestamp issue in GoZync 5 Breaks $gz_LastTimeZync

PostPosted: Fri Jan 23, 2015 6:26 pm
by jeffalmquist
Sounds good, Peter. Thanks for letting us know!

Re: Timestamp issue in GoZync 5 Breaks $gz_LastTimeZync

PostPosted: Sat Mar 21, 2015 11:03 am
by jeffalmquist
I've added some notes about cloning the GoZyncMobile file into our documentation here:
http://www.seedcode.com/pmwiki/index.ph ... ateFormats