Syncdata()

Discussions about syncing data via Bluetooth, Dropbox, FTP, and using CSWeb
Forum rules
New release: CSPro 8.0
Mutanen Lau
Posts: 22
Joined: November 8th, 2016, 10:48 am

Syncdata()

Post by Mutanen Lau »

i read all post relating to synchronization as well as cspro help on synchronization but i cant get around this error
ERROR: Invalid function call (external dictionary name expected) near line 27 in GLOBAL procedure

below is the function i defined for the synchronization

Code: Select all

Function syncToDropbox()
	if syncconnect(Dropbox) = 1 then
		syncdata(PUT,PVHH_DICT);
		syncfile(PUT,"/photo/*.jpg","../photo");
		
		syncfile(GET,"/NASSCO/PVHH.pen","PVHH.pen");
		syncfile(GET,"/NASSCO/PVHH.pff");
		
		syncdisconnect();
	endif;
end;
the colored line is where the error message is pointing at, PVHH_DICT is the only dictionary i used yet still requesting for an external dictionary.
please what am i missing? i have been battling for almost a week.
thanks
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Syncdata()

Post by josh »

In CSPro you have one main dictionary (the one you use when you create the application) and you can also have zero or more external dictionaries (which you add to the application via "Add Files" from the file menu). Cases in the main dictionary are loaded and saved automatically for you as the starts/completes entering a case. Cases in external dictionaries are loaded/saved by the programmer in logic using the loadcase/writecase commands.

We only support syncdata() on external dictionaries. Since PVHH_DICT is your main dictionary you are getting an error that it wants an external dictionary. When using syncdata in logc we generally use a separate CSPro program than the one used for data entry. It is usually referred to as a menu program since it doesn't involve data entry but just presents options to the user in the form of menus. The menu program does sync and also launches the real data entry program. There is an example of this in the "Synchronization in Logic" example in the CSPro examples folder. You can also read more about menu programs in general here: http://teleyah.com/cspro/SouthAfricaOct2016/08-Menu.pdf
Mutanen Lau
Posts: 22
Joined: November 8th, 2016, 10:48 am

Re: Syncdata()

Post by Mutanen Lau »

Thanks Josh
if i understand you very well, do i have to create another dictionary for the menu and build the synchronization logic in the menu and refer to the main dictionary as the external dictionary therein
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Syncdata()

Post by josh »

Yes, that is correct. Create a new CSPro application for the menu, create a new dictionary for the menu (this can be as part of the application creation) and then add the original dictionary as an external dictionary to your menu program.
Mutanen Lau
Posts: 22
Joined: November 8th, 2016, 10:48 am

Re: Syncdata()

Post by Mutanen Lau »

thank you, i have done it. another challenge i ha m having is after i deployed the application to my android device both the menu and main entry applications show up. how can i make the menu to be the only app the interviewer will see. that is hiding the main entry only to be access through the menu.
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Syncdata()

Post by htuser »

Hi Lau,
This has been responded on the forum.
http://csprousers.org/forum/viewtopic.p ... ting#p6382
http://csprousers.org/forum/viewtopic.p ... ting#p6187
Please pass this: filewrite(outputFile,"ShowInApplicationListing=Never") for the main application pff's creation, this in the menu.
outputfile is the pff file.
Best Regards,
G.VOLNY, a CSProuser from Haiti, since 2004
sah
Posts: 97
Joined: May 28th, 2015, 3:16 pm

Re: Syncdata()

Post by sah »

Another approach is to edit the pff and show the hide option, so when you launch the menu, the main apps will launch without others seeing the apps
Mutanen Lau
Posts: 22
Joined: November 8th, 2016, 10:48 am

Re: Syncdata()

Post by Mutanen Lau »

thanks a lot, i appreciate you all.
another challenge now is, i am unable to see the case tree, does it mean if i choose to hide the application on the application listing i can view the case tree associated with that application. i want to view the completed and partial save cases. please help.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Syncdata()

Post by josh »

Do you mean the case listing? The case tree is the list of fields on the left of the screen that you see while entering data. You can modify its visibility both on the tablet (from the menu during data entry) or when designing the application in the Data Entry Options dialog.

The case listing is the list of cases you see when you first open the application. That will always be visible unless you add "Lock=CaseListing" to the pff file or if you set the "StartMode" in the pff file. This is independent of ShowInApplicationListing.
Mutanen Lau
Posts: 22
Joined: November 8th, 2016, 10:48 am

Re: Syncdata()

Post by Mutanen Lau »

I don't know what i will do without you "Thank you" will not show my appreciation. Another idea i 'm trying to conceive has to do with data file *.csdb. i have about fifty android phones to deploy my application on, but i want each device to have a unique data file name such as "deviceid.csdb" can i do it in the logic or .pff. i don't want to manually do it i want the application to detect the device id using

Code: Select all

getdeviceid()
and named the data file appropriately.
thanks.
Post Reply