Hi Developer team,
I hope you're fine and hardly working for the next beta, mainly with password protected csdb.
I would like to know if there's a way to use the last time sync from Mysql inside cspro logic? This is very important because we would like that each enumerator to synchronize each day or at specific interval regarding last successful sync.
Thanks in advance,
Last sync time
Last sync time
G.VOLNY, a CSProuser from Haiti, since 2004
Re: Last sync time
This information is not available currently through CSPro logic. We would recommend that you use sysdate()/systime() to capture the time of the last synchronization and save that in settings (using savesetting).
Re: Last sync time
Hi Josh,
Thanks for your precious support. However, this approach doesn't allow cspro logic to know if sync failed or no. Since i want to know the last succeded sync , ideas you give me isn't sufficient. I can do it only if i can retrieve server_revision, direction and timestamp infos from csdb in cspro logic.
Best regards,
Thanks for your precious support. However, this approach doesn't allow cspro logic to know if sync failed or no. Since i want to know the last succeded sync , ideas you give me isn't sufficient. I can do it only if i can retrieve server_revision, direction and timestamp infos from csdb in cspro logic.
Best regards,
G.VOLNY, a CSProuser from Haiti, since 2004
Re: Last sync time
If sync failed then the sync_data function will return 0. If it succeeded then it will return 1. Only save the date to settings if sync_data returns 1.
-
- Posts: 6
- Joined: May 2nd, 2019, 5:54 am
Re: Last sync time
Hi Josh,josh wrote:If sync failed then the sync_data function will return 0. If it succeeded then it will return 1. Only save the date to settings if sync_data returns 1.
It would be great help you share the small example of last sync time.
Thanks & Regards,
Bhavesh
Re: Last sync time
Here's an example of what Josh was recommending.
numeric syncTimestamp;
// For brevity I have excluded connect/disconnect logic
if syncdata(PUT,SURVEY_DICT) then
// Sync was successful
syncTimestamp = timestamp;
enddif;
// Use savesetting to make timestamp persistent
savesetting("LastSuccessfulSync", maketext("%d", syncTimestamp));
Now, what you do with the last successful sync is up to you.// For brevity I have excluded connect/disconnect logic
if syncdata(PUT,SURVEY_DICT) then
// Sync was successful
syncTimestamp = timestamp;
enddif;
// Use savesetting to make timestamp persistent
savesetting("LastSuccessfulSync", maketext("%d", syncTimestamp));
-
- Posts: 6
- Joined: May 2nd, 2019, 5:54 am
Re: Last sync time
Dear Aaronw,
if you have a small example of last sync application then please provide i am getting error in menu and main prog.
Before syncronization of the data how to get the current time into the database ? Pl. give us some small application which explain the logic.
Thanks & Regards,
Bhavesh
if you have a small example of last sync application then please provide i am getting error in menu and main prog.
Before syncronization of the data how to get the current time into the database ? Pl. give us some small application which explain the logic.
Thanks & Regards,
Bhavesh
Re: Last sync time
I don't have an example. However, I think I've demonstrated the key idea. As Josh stated we don't have the functionality to get the last sync time from the MySQL database through logic. In lieu of that we record the last sync time on the device when it happens.