Page 1 of 1

syncdata with an optional parameter CLEAR

Posted: November 13th, 2020, 4:08 pm
by AriSilva
I have an application that uses the server to download control files for the interviewers.
These control files need some updating from the supervisors, and the problem we are facing is that the sycdata with a put parameter is duplicating the records n the server.
I thought about having an optional parameter like
syncdata(put, dict, universe, clear);
to clear the data in the server before uploading.
Or do you have an alternative solution?

Re: syncdata with an optional parameter CLEAR

Posted: November 14th, 2020, 6:04 pm
by Gregory Martin
We will keep your suggestion in mind. An idea I have had is to allow the definition of a user-defined function like OnSyncConflict that you can add to your logic to help resolve sync conflicts. (I don't work on any of the sync code though.)

Re: syncdata with an optional parameter CLEAR

Posted: November 15th, 2020, 10:53 am
by josh
Sync will only create duplicates if you are creating new cases on multiple devices i.e. user 1 creates a case on her tablet and then user 2 creates another case with the same case id on his tablet. If you create the cases for the control file ahead of time, download them to the tablets and then have the user modify the cases instead of creating new ones you won't have any duplicates.

Other strategies that people use to avoid duplicates are to limit which users are allowed to create cases with certain ids through an assignments lookup file. User 1 is assigned area 1 and can only create cases with ids in that area, user 2 can only create cases in area 2... Alternatively, add an additional ID variable to each case which is specific to the user (like a user code) which makes it easier to figure out how to handle the duplicates.