Apps sharing the same external data file

Discussions about CSEntry
Post Reply
wimneel
Posts: 91
Joined: May 6th, 2017, 5:31 am

Apps sharing the same external data file

Post by wimneel »

Hi,

Can anybody point me to an explanation of how to have two apps share the same external data file?
I have difficulty understanding where the external data file should be stored on the local computer, how the two apps should be deployed (e.g. should both have the external file in its deploy specifications?) and where the external data file will be stored on the tablets.
Any help is very much appreciated.
justinlakier
Posts: 156
Joined: November 21st, 2022, 4:41 pm

Re: Apps sharing the same external data file

Post by justinlakier »

Hello,

here is the documentation on external data files. It has links to the documentation pages for lookup files and inserting/dropping files from an application as well.

To have two apps share an external data file, add the dictionary to both as an external file by going to File -> Add Files -> External Dictionary. Then, when running the application, add a data file corresponding to that dictionary in the pff, either an existing .csdb or a new one. Make sure it is the same external data file between applications. Keep in mind that having multiple dictionaries will mean you cannot repeat variable names between dictionaries due to ambiguity, so you may need to introduce prefixing to names if your external dictionary shares variable names with your other dictionaries.

If you have 1 overarching project folder, and 2 folders within it named "App 1" and "App 2", then shared data files are often put in a folder next to the App folders named "Data". However this is just a suggestion, the actual location is not particularly important so long as the relative paths set in the app's pffs when running are correct. Relative paths are used on both local computer and after deploying to Android.

For deploying multiple apps, you can go to Tools -> Deploy Application to open a .csds window listing that app's necessary files to deploy. You can add both the shared external data dictionary and the deploy files for the other application, and now have a .csds that will deploy multiple apps and their shared data file at the same time. You can save this .csds file for repeated deploys.

Hope this helps,
Justin
emmayashri
Posts: 6
Joined: April 9th, 2024, 3:45 am
Location: India

Re: Apps sharing the same external data file

Post by emmayashri »

Hey hi, you can store the file in a common directory accessible by both apps. Each app can then access the file using its file path and don't forget to check both apps have permission to read and write to this directory. I'm thinking this question taken from StackOverflow and here is discussion about the same thing.
wimneel
Posts: 91
Joined: May 6th, 2017, 5:31 am

Re: Apps sharing the same external data file

Post by wimneel »

Thank you both very much for this very usefull information.
wimneel
Posts: 91
Joined: May 6th, 2017, 5:31 am

Re: Apps sharing the same external data file

Post by wimneel »

I have tried to follow your good advice, creating two apps, putting them in a common folder, and creating deployment specifications for the whole package.

Deployment to the server starts normally, but after a while it returns the following message:
Error: unable to read response from server. See log.file for details.
The sync.log gives this message:
ERROR: Invalid server response: Not a string

In the CSWeb Dashboard section "Apps" I can see that the package was uploaded, but in the section "Data" there is no dictionary!
Downloading and installing the package to a tablet seems to work normally, but when trying to synchronise, an error message pops up that translates to:
Resource not found on server [server name]. Check if the CSWeb server address is correct
(Recurso não encontrado no servidor http://...... Verifique se o endereço do servidor CSWeb está correcto)

The problem is definitely not the server address.
Does anybody have any idea of what I could be doing wrong?

Thanks for your help.
justinlakier
Posts: 156
Joined: November 21st, 2022, 4:41 pm

Re: Apps sharing the same external data file

Post by justinlakier »

Hello,

If you need more examples, you can check the CSPro Examples folder, where the CAPI Census example uses shared external dictionaries and deploy scripts. If this does not help, please attach your zipped application here or send it to cspro@lists.census.gov if it is confidential, so that we can test it.

Hope this helps,
Justin
wimneel
Posts: 91
Joined: May 6th, 2017, 5:31 am

Re: Apps sharing the same external data file

Post by wimneel »

Dear Justin,

Thank you for your help.
I just sent my apps to cspro@lists.census.gov.

In the meantime, do you have any idea what "Invalid server response: Not a string" could mean? There are a few posts about ths message on the forum, and they all suggest a problem with file size. Is there any restriction on the size of files used in CSPro?
savy
Posts: 163
Joined: December 27th, 2012, 1:36 pm

Re: Apps sharing the same external data file

Post by savy »

It appears that you have problem with the php limits. Please refer to this post.
viewtopic.php?p=17620&hilit=Error+uploa ... ror#p17620
wimneel
Posts: 91
Joined: May 6th, 2017, 5:31 am

Re: Apps sharing the same external data file

Post by wimneel »

The max upload size of PHP on the server is 64MB.
That can hardly be the problem.
Post Reply