Timestamp issue in GoZync 5 Breaks $gz_LastTimeZync
Posted: 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
In the hosted file:
"Get IDS Needed For Sync PSOS" script:
Change "Set Variable [ $gz_LastTimeZync...]" to
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
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