Invalid file used with syncdata

Discussions about syncing data via Bluetooth, Dropbox, FTP, and using CSWeb
Forum rules
New release: CSPro 8.0
Post Reply
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Invalid file used with syncdata

Post by khurshid.arshad »

Dear team

I am facing this error during synchronization with dropbox:

Invalid file used with syncdata for "dictionary name", only CSPRo DB files support sync. Please make sure that the file type is CSPro DB and that it is not closed in CSPro application logic.


My file extension is csdb.

Code: Select all

Function SynDatatoServer();
		if syncconnect(Dropbox) then
		  syncdata(PUT,COMMUNITY_DICT);
				syncdisconnect();
		else
		endif;
end;
thanks.
a.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Invalid file used with syncdata

Post by josh »

Are you using a text file or a csdb file with the dictionary COMMUNITY_DICT? Syncdata does not work with text files.
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Invalid file used with syncdata

Post by khurshid.arshad »

Dear Josh;

File extension is “csdb”. My application structure is as follows:
  • 1. Login screen
    • 1.1 Cluster information Screen
1.1.1.1 Community Questionnaire (One questionnaire for each cluster)
1.1.1.2 Household Information (cover page and roster only)
1.1.1.3 Individual information (number of files based on the household information, education, health employment etc.)
1.1.1.4 Household information (including HH consumption, dwelling characteristics etc.)

At the end of interview we have multiple files against each household.

How it works:
Login screen determines whether the user is enumerator or supervisor and creates a “pff file” for cluster information screen.
Cluster information screen determines in which cluster user wants to work and which activity he would like to perform. Here we are using Community Dictionary as external for data synchronization.

The cluster screen has following options:
Enumerator can only start interview and send data to supervisor.
Supervisor can perform following activities:
1. Assign household to the enumerator
2. Conduct Community Questionnaire
3. Receive Data from enumerator
4. Send Data to the server
However the problem is when we create pff file for cluster screen, we don’t know the file name for community dictionary, and so we cannot give any information about community file. And when we run synchronization, it gives error.
Against each supervisor we have multi community files and we want all these files synchronize.

Thanks.
a.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Invalid file used with syncdata

Post by josh »

That error will only happen if the file type is text or if the external dictionary is not associated with any file at all. In your case you probably need to use setfile() to associate the dictionary with a csdb file before doing the sync.
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Invalid file used with syncdata

Post by khurshid.arshad »

Dear Josh

Thank you for your reply. Can you give me an example.
Thanks.
a.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Invalid file used with syncdata

Post by josh »

There is one in the help for setfile.
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Invalid file used with syncdata

Post by khurshid.arshad »

Dear Josh;
This is the following code which i am using in my application and it is working. If I can improve this syntax, please give me some advice.
Thank you.
A.

Code: Select all

PROC GLOBAL
Numeric iFile;
list string filelisting;


Function SynDatatoServer();
	if syncconnect(Dropbox)=1 then
		dirlist (filelisting, "..\WORK\COM\", "COM-*.csdb");
		do iFile=1 while iFile<=length(filelisting);
			if setfile(COMMUNITY_DICT, filelisting(IFile))=0 then
				errmsg ("File does not exist %s.", filelisting(IFile));
			else
				setfile (COMMUNITY_DICT, filelisting(IFile));
				syncdata(PUT,COMMUNITY_DICT);
			endif;
		enddo;
		syncdisconnect();
	else
	endif;
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Invalid file used with syncdata

Post by josh »

That looks pretty reasonable to me.
Post Reply