sync_universe

Discussions about syncing data via Bluetooth, Dropbox, FTP, and using CSWeb
josue19
Posts: 5
Joined: November 26th, 2017, 8:11 pm

sync_universe

Postby josue19 » March 14th, 2018, 11:22 am

Hello Good morning, my name is Byron, I am currently working on a modernization project in place where I work and we are going to do interviews with tablets, I have prepared a server with apache and xamp for the service and I did tests of lifting and synchronization, but I am trying to synchronize a universe of data in an example that brings cspro ("Synchronization In Logic") in which I only want to synchronize a specific home, I only use an id, there are no compilation errors but it does not synchronize my universe either. please I need you to give me some idea of how to make it work, I attach the code that makes it.

if syncconnect(CSWeb,"https://192.168.0.101:8080/survey/api") then
string assignmentUniverse = maketext("%600d",HOUSEHOLD_NUMBER);
syncdata(BOTH,HOUSEHOLDQUESTIONNAIRE_DICT,assignmentUniverse);

syncdisconnect();

endif;

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

Re: sync_universe

Postby josh » March 14th, 2018, 11:27 am

The problem is most likely with the "%600d". This is going to make a text string that is padded with spaces so that it is 600 characters long. You should make the length of this match the length of the household number. In the synchronization in logic example the household number field is 3 characters long so you would use "%3d" to get a string the same length.

josue19
Posts: 5
Joined: November 26th, 2017, 8:11 pm

Re: sync_universe

Postby josue19 » March 14th, 2018, 1:22 pm

I change the value to 3 and compile and it still does not synchronize. "%3d",
in the sync help the following appears:

"By providing an optional string expression for the sync_universe argument, you can limit the cases that are transferred. The universe is matched against the ID items of each of the cases. Only cases whose ID items concatenated together match the universe will be transferred. For example, if the universe is "123" then cases with IDs "1234" and "1235" would be synced but a case with IDs "2345" would not."

Example 2
if syncconnect(Bluetooth) then

// sync data for only the province and district assigned to the interviewer
string assignmentUniverse = maketext("%02d%02d",ASSIGNED_PROVINCE,ASSIGNED_DISTRICT);
syncdata(BOTH,CENSUS_DICT,assignmentUniverse);

syncdisconnect();

endif;

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

Re: sync_universe

Postby josh » March 14th, 2018, 1:52 pm

Post your application and I will take a look at it.

josue19
Posts: 5
Joined: November 26th, 2017, 8:11 pm

Re: sync_universe

Postby josue19 » March 14th, 2018, 1:59 pm

Thank you very much.
Last edited by josue19 on March 14th, 2018, 2:50 pm, edited 1 time in total.

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

Re: sync_universe

Postby josh » March 14th, 2018, 2:04 pm

The variable HOUSEHOLD_NUMBER has not been set to anything. By default it is blank so you are using a blank universe which does not match any of your cases. You need to set it to the id of the household you want to sync.

josue19
Posts: 5
Joined: November 26th, 2017, 8:11 pm

Re: sync_universe

Postby josue19 » March 14th, 2018, 3:15 pm

Could you please explain me with a practical example with the application that you send.

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

Re: sync_universe

Postby josh » March 14th, 2018, 4:02 pm

It depends what you want to do. If you want to only sync household number 3 then you would do something like:

HOUSEHOLD_NUMBER = 3;
string assignmentUniverse = maketext("%3d",HOUSEHOLD_NUMBER);
syncdata(BOTH,HOUSEHOLDQUESTIONNAIRE_DICT,assignmentUniverse);

Why do you need to use a universe with syncdata? Most of the time you do not need it.

josue19
Posts: 5
Joined: November 26th, 2017, 8:11 pm

Re: sync_universe

Postby josue19 » March 14th, 2018, 5:15 pm

Thank you very much.
what happens is that we have a survey methodology by sector, one sector is assigned per interviewer but if it is very large with many households, another interview must be sent to support it, in which case the base is shared via bluetoth to work on that, and avoid duplication of information, this is just a proposed strategy that we intend to prove we do not know if it is possible to carry it out.


Return to “Synchronization”