Help needed for automatic sync function

Other discussions about CSPro
Forum rules
New release: CSPro 8.0
Post Reply
Tuan
Posts: 29
Joined: November 18th, 2013, 6:42 pm

Help needed for automatic sync function

Post 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;
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Help needed for automatic sync function

Post 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.
Tuan
Posts: 29
Joined: November 18th, 2013, 6:42 pm

Re: Help needed for automatic sync function

Post by Tuan »

Hi Josh

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

Best
Tuan
Post Reply