Error in syncing from Dropbox

Discussions about syncing data via Bluetooth, Dropbox, FTP, and using CSWeb
Post Reply
sat_ind
Posts: 3
Joined: May 11th, 2020, 1:49 pm

Error in syncing from Dropbox

Post by sat_ind »

Hi,

I am a first-time CSPro user and am struggling to sync to dropbox. I have copied .PEN .PFF and .PNC file (used coding to auto-generate folders for separate UIDs - or that's what I think I've done).

This seems to be syncing and working on my phone but when I share these files via dropbox to another CSEntry android app user something seems to be going wrong and I keep getting this error.

I also have re-done the steps for Deploy Application tool, re-created .PEN and .PFF files but to no avail!

Please help!
Attachments
WhatsApp Image 2020-05-11 at 11.16.25 PM.jpeg
WhatsApp Image 2020-05-11 at 11.16.25 PM.jpeg (37.36 KiB) Viewed 4610 times
sat_ind
Posts: 3
Joined: May 11th, 2020, 1:49 pm

Re: Error in syncing from Dropbox

Post by sat_ind »

This is the coding I've used for .PNC
(At the cost of sounding stupid, one would use notepad to make this coding and just rename the notepad to *name of file.PNC* right? Didn't quite understand what this .PNC thing was)


[SyncFile]
Version=CSPro 7.3
Description=Synchronize Mitaan_Details_App with Dropbox
[Connection]
Type=Dropbox
[Sync]
CreateClientPath=/Trial 1
ClientPath=/Trial 1
ServerPath=/SyncTrial 1/app
Get=Mitaan_Details_App.PEN
Get=Mitaan_Details_App.PFF
CreateServerPath=/SyncTrial_1/data/%UID%/
ServerPath=/SyncTrial_1/data/%UID%/
Put=Trial_1.dat
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Error in syncing from Dropbox

Post by josh »

CSPro stopped supporting PNC files many years ago. They were replaced with either simple synchronization using the synchronization options or using the syncxxx() functions in CSPro logic. Please see this document for step by step instructions on using sync with Dropbox https://www.csprousers.org/resources/Si ... ropbox.pdf.

Note that Dropbox expects the files to always be in the folder Dropbox/CSPro/apps for deployed applications or Dropbox/CSPro/DataSync for data synchronization so if you share the folder with another Dropbox account they need to put the files in the same folder in their Dropbox. To avoid that complication most people just use a single Dropbox account that is shared by all the Android devices.
sat_ind
Posts: 3
Joined: May 11th, 2020, 1:49 pm

Re: Error in syncing from Dropbox

Post by sat_ind »

Thank you for your reply! I did as given in the PDF and have still not been able to rectify the problem.
I keep getting this pop-up error message everytime I try and sync (even from new devices). Any solutions?

Best,
S
Attachments
WhatsApp Image 2020-05-12 at 11.02.45 AM.jpeg
WhatsApp Image 2020-05-12 at 11.02.45 AM.jpeg (32.26 KiB) Viewed 4581 times
eeng
Posts: 12
Joined: January 20th, 2012, 6:18 pm

Re: Error in syncing from Dropbox

Post by eeng »

hi ..

this app my menu still use dat (text data). syncronizing using command in app program.

note wilcah mean enumaretaor area", clustered fieldwork, ie , 001, 002, etc


-eeng
---

{Application 'LAUNCHER' logic file generated by CSPro}
PROC GLOBAL

alpha(2) xbook; {Kode Book}
alpha(26) alphalst, alphaku, alphachk;
numeric zbook,result;

// Arrays for dynamic value sets
array string codesString(100);
array string labels(100);


{function backup()
result = execsystem(concat("pkzipc -add","..","\","Data","\","BP","_",ENUMID," ",concat("..","\","Data","\","*.*")));
if result = 0 then
errmsg("Failed to ZIP any files - please check");
else
errmsg("ZIP Data %d files",result);
endif;
end;
}


function chkblank(alpha(8) atmp, alpha(60) aval);
chkblank = 0;
if aval[1:1] = " " | (length(strip(aval)) = 1 & !(aval[1:1] in "Z","W")) then
chkblank = 1;
errmsg("%s",strip(atmp));
endif;
end;

function backups()
result = filecopy(concat(".\Data\","*",ENUMID,".*"),".\Backup\");
if result = 0 then
errmsg("Failed to copy any files - please check");
else
errmsg("Copied %d files",result);
endif;
end;


file pffFile;


function CreateAndRunPFF()
// Generate a pff file for the data entry program
// and execute it. See "Run Production Data Entry"
// in the online help for more information on the format
// of the pff file.

// Get paths to survey application relative
// the current application path.
string surveyApplicationPath = pathname(Application);
string surveyDataPath = concat(pathname(Application),"Data\");

// Put the generated pff file in the temp directory
// so it doesn't show up on the list of applications on
// Android.

string pffFilename = concat(pathname(Temp), "Entry.pff");
setfile(pffFile,pffFilename,create);
filewrite(pffFile,"[Run Information]");
filewrite(pffFile,"Version=CSPro 7.1");
filewrite(pffFile,"AppType=Entry");

filewrite(pffFile,"[DataEntryInit]");
filewrite(pfffile,concat("OperatorID=",ENUMID));

if menu = 1 then
filewrite(pfffile, "Fullscreen=Yes");
filewrite(pfffile, "StartMode=Add");
filewrite(pfffile, "Lock=Verify,Modify");
filewrite(pfffile, "Fullscreen=Yes");
elseif menu = 2 then
filewrite(pfffile, "StartMode=Modify");
filewrite(pfffile, "Fullscreen=No");
filewrite(pfffile, "Lock=Add,Verify");
endif;
filewrite(pfffile, "NoFileOpen=Yes");
filewrite(pfffile, "");

filewrite(pffFile,"[Files]");
if menu in 1:2 then
filewrite(pfffile, concat("Application=","%sEntry",strip(xbook),".ent"),surveyApplicationPath);
filewrite(pffFile,"InputData=%s%s_pjj1_%s.Dat",surveyDataPath,concat("E",strip(xbook)),wilcah);
endif;

filewrite(pfffile, "");
filewrite(pffFile,"[ExternalFiles]");
filewrite(pffFile,"LOCCODES=%sReff\LOC2014.Dat", surveyApplicationPath);
filewrite(pffFile,"B1SMP_DICT=%sReff\SMP_B1.Dat", surveyApplicationPath);
filewrite(pffFile,"STAFF_DICT=%sReff\STAFF.Dat", surveyApplicationPath);

filewrite(pfffile, "");
filewrite(pffFile,"[UserFiles]");


filewrite(pfffile, "");
filewrite(pffFile,"[Parameters]");

// This passes the district ids as parameters to the survey
// application which can access them via the sysparm() function.

filewrite(pffFile,"Parameter=%s", ENUMID);
close(pffFile);

if getos() in 20:29 then
// Android - can't have two apps at once so stop
// and let survey run.
execpff(filename(pffFile), stop);
else
// Windows - wait for survey to finish.
execpff(filename(pffFile), wait);
endif;

end;


PROC LAUNCHER_FF

preproc

alphalst="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
setfont(ValueSets, "Arial Narrow", 16, bold);


PROC ENUMID


preproc

string InterviewerNameKey = "InterviewerName";
ENUMID = loadsetting(InterviewerNameKey);

postproc
if ENUMID = "" then
errmsg("You must enter the interviewer's name.");
reenter;
endif;

savesetting(InterviewerNameKey,ENUMID);


{ Add checks for operator here }
if !pos($[1:1],"SE") | !pos($[2:1],"0123") | !pos($[3:1],"1234567890") then
errmsg("Editor code is invalid, expected E01,E02,...,E05");
reenter;
endif;

if loadcase(STAFF_DICT,ENUMID) then
// Save login code to settings so we can load it when menu restarts
savesetting("InterviewerNameKey", maketext("%s", ENUMID));
endif;
PROC WILCAH
if chkblank(getsymbol(),$) then
reenter;
endif;

if length(strip($)) < 3 then
errmsg("Wilcah yang dientry %s salah kurang dari 3 digit",$);
reenter;
endif;
PROC MENU
//Defining data upload

{
if MENU = 3 & ENUMID in "S01" then
errmsg("Upload data menggunakan FTP SERVER!");
reenter
endif;

if MENU = 4 & ENUMID in "S01","S02" then
errmsg("Upload data menggunakan dropbox!");
reenter;
endif;

}


// Handle menu choice
if MENU = 1 then
{ errmsg("Backup dropbox belum aktif");
reenter;}

// send the latest cases to Dropbox
elseif MENU = 3 & (pos(ENUMID[1:1],"SP") | pos(ENUMID[2:1],"0123") | pos(ENUMID[3:1],"1234567890") ) then


if syncconnect(Dropbox) then
syncfile(PUT,maketext("./Data/*%s.Dat",WILCAH),"/SyncdataPJJ1");
syncfile(PUT,maketext("./Data/*%s*.Log",WILCAH),"/SyncdataPJJ1");
syncfile(PUT,maketext("./Data/*%s*.sts",WILCAH),"/SyncdataPJJ1");

syncdisconnect();
endif;
reenter;
elseif MENU = 5 then
elseif MENU = 9 then

// Quit
stop(1);
endif;

PROC BOOK

if BOOK in 1,2 then
zbook = book;
xbook = "B1B2"[(2*zbook-1):2];
{1234}
CreateAndRunPFF();

reenter ENUMID;
elseif BOOK = 3 then reenter ENUMID
elseif BOOK = 9 then
// Quit
stop(1);
endif;
eeng
Posts: 12
Joined: January 20th, 2012, 6:18 pm

Re: Error in syncing from Dropbox

Post by eeng »

example menu visualization:
data operator id.jpeg
data operator id.jpeg (144.5 KiB) Viewed 4579 times
ea.jpeg
ea.jpeg (80.69 KiB) Viewed 4579 times
eeng
Posts: 12
Joined: January 20th, 2012, 6:18 pm

Re: Error in syncing from Dropbox

Post by eeng »

Main menu.jpeg
Main menu.jpeg (51.23 KiB) Viewed 4579 times
choose form.jpeg
choose form.jpeg (38.33 KiB) Viewed 4579 times
eeng
Posts: 12
Joined: January 20th, 2012, 6:18 pm

Re: Error in syncing from Dropbox

Post by eeng »

dictionary & form
Attachments
Menu_dict.zip
(1.35 KiB) Downloaded 206 times
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Error in syncing from Dropbox

Post by josh »

You can't use text files with sync. You need to use csdb files.
Post Reply