Page 1 of 1

Help needed for automatic sync function

Posted: April 13th, 2016, 8:49 am
by Tuan
Dear Members

I tried follows code to have automatic synchronize - sending file to dropbox but failed. Any assistance appreciated.

// at the beginning of the program, queue up the synchronization script for
// execution when the program ends
// If having WIFI or Mobile connections then

if Connection() then

// Check time if at night = 22h00

seed(systime());

If systime() = 220000 Then {HHMMSS}

sync("Send_DataToServer.PNC", queue);
endif;

endif;

Re: Help needed for automatic sync function

Posted: April 14th, 2016, 10:56 am
by josh
This will only work if you happen to execute this logic at exactly 22:00 and zero seconds which is rather unlikely. You probably want to save off the last time you successfully synced and then sync if a certain amount of time has passed since the last sync. You could probably do this by saving the last synced time to a text file using filewrite and then read it back using filewrite but honestly I don't think it is worth the complexity. Just tell your enumerators to run the sync manually.

Re: Help needed for automatic sync function

Posted: April 15th, 2016, 12:33 am
by Tuan
Hi Josh

Many thanks for advise. Will ask our enumerators send manually then.

Best
Tuan