Timestamp issue in GoZync 5 Breaks $gz_LastTimeZync

Help, Tips, and Tricks for deploying GoZync: our "sync" engine for FileMaker Go.
Posts: 17
Joined: Fri Apr 23, 2010 5:58 am
Location: Jackson's Point, ON
PostPosted: Thu Jan 22, 2015 6:43 pm
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
SeedCode Staff
SeedCode Staff
Posts: 475
Joined: Wed Jan 02, 2013 11:47 am
PostPosted: Thu Jan 22, 2015 6:58 pm
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
Posts: 17
Joined: Fri Apr 23, 2010 5:58 am
Location: Jackson's Point, ON
PostPosted: Thu Jan 22, 2015 7:30 pm
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?
SeedCode Staff
SeedCode Staff
Posts: 475
Joined: Wed Jan 02, 2013 11:47 am
PostPosted: Thu Jan 22, 2015 7:35 pm
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?
Posts: 17
Joined: Fri Apr 23, 2010 5:58 am
Location: Jackson's Point, ON
PostPosted: Fri Jan 23, 2015 4:44 am
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
Posts: 17
Joined: Fri Apr 23, 2010 5:58 am
Location: Jackson's Point, ON
PostPosted: Fri Jan 23, 2015 2:44 pm
Further to this, we've tested on multiple remote systems and it looks like it's pulling the correct records. Thanks very much!
SeedCode Staff
SeedCode Staff
Posts: 475
Joined: Wed Jan 02, 2013 11:47 am
PostPosted: Fri Jan 23, 2015 6:26 pm
Sounds good, Peter. Thanks for letting us know!
SeedCode Staff
SeedCode Staff
Posts: 475
Joined: Wed Jan 02, 2013 11:47 am
PostPosted: Sat Mar 21, 2015 11:03 am
I've added some notes about cloning the GoZyncMobile file into our documentation here:
http://www.seedcode.com/pmwiki/index.ph ... ateFormats

Return to GoZync

Who is online

Users browsing this forum: No registered users and 1 guest

(855) SEEDCODE
[email protected]
Follow us: