syncdata with an optional parameter CLEAR

What would you like to see in CSPro?
Post Reply
Posts: 471
Joined: July 22nd, 2016, 3:55 pm

syncdata with an optional parameter CLEAR

Post by AriSilva » November 13th, 2020, 4:08 pm

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?

Gregory Martin
Posts: 1475
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: syncdata with an optional parameter CLEAR

Post by Gregory Martin » November 14th, 2020, 6:04 pm

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.)

Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: syncdata with an optional parameter CLEAR

Post by josh » November 15th, 2020, 10:53 am

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.

Post Reply