Page 1 of 2
Update external database when save success
Posted: May 11th, 2021, 3:04 am
by emdisala
Dear all,
Update external database when save success
I need to update a field belong to an external dictionary through data entry application only after accept the case.
To demonstrate created simple menu driven system to add households and persons separately (Two Entry Programs) (relationship household has many persons).
In household there is field called “PERSONCOUNT”. The persons data entry system should update the count of persons belong the household only when save.
For that purpose wrote function updateNoofPersons(HouseHoldNumber,PersonCount);
I need to call function only case is accepted. (Only when save). But I couldn’t place this in a correct proc as well couldn’t find onSave() like function.
Where (Proc) and how (only after save) I place said function to achieve the said objective
Simple sample program attached (CSPro 7.6) / Entry point: MainMenu.pff
Thank you
Disala
Re: Update external database when save success
Posted: May 11th, 2021, 11:22 am
by aaronw
I don't believe there is a way to access logic after the case-confirmation button has been confirmed. My suggestion is to not recreate the person count in household, because the challenge then becomes keeping it in sync. Instead, access the person data as an external dictionary in the household application when needed.
Re: Update external database when save success
Posted: May 12th, 2021, 12:03 am
by emdisala
Dear Aaronw
Thank you very much for your reply and comments, Could you please explain what do you mean by challenge keeping it in sync.
The attached sample program design to use two separate dictionaries and I think it is very easy to handle person record without making a roster in same dictionary. When sync data to the server have to sync both dictionaries. There is a challenge. First, I sync household after that person. If person sync failed I can identify using PERSONCOUNT for incompleteness. (PERSONCOUNT=countcases of persons where house hold number =current household number)
Can you please comment on this regard as well?
Thank you
Disala
aaronw wrote: May 11th, 2021, 11:22 am
I don't believe there is a way to access logic after the case-confirmation button has been confirmed. My suggestion is to not recreate the person count in household, because the challenge then becomes keeping it in sync. Instead, access the person data as an external dictionary in the household application when needed.
Re: Update external database when save success
Posted: May 12th, 2021, 9:57 am
by aaronw
When I said it could be a challenge to keep the person count in sync between the person and household data files I was not referring to the sync (upload/download) functionality. Instead, I was referring to the fact that keeping the person count in sync (the same) between the person and household data file will become the real task.
I personally think the better solution is not to duplicate the person count, but simply reference it when needed. You'll do this by adding the person dictionary to the household application as an external lookup.
Re: Update external database when save success
Posted: May 12th, 2021, 2:21 pm
by Gregory Martin
Whether or not it is a good idea to have variables that you have to keep in sync, you can always turn off "Confirm end-of-case" here:
https://www.csprousers.org/help/CSPro/c ... tions.html
Then, instead of using CSEntry's default confirmation, you could add an item to your dictionary and create your own confirmation screen. Then, in the postproc of that confirmation, you could update your external databases.
For all of my projects I turn off this confirmation and use my own as I prefer being able to customize the confirmation text that is presented to enumerators.
Re: Update external database when save success
Posted: May 13th, 2021, 1:48 am
by emdisala
Dear Arronw
Thank you for your attention and kindness. Agree with you not to keep earlier said “PERSONCOUNT” as dictionary item and do reference. In my case I sync two dictionaries (databases). First the database with PERSONCOUNT next the other one. I thought this would become a mechanism to check completeness of data sync over mobile network by matching PERSONCOUNT against the count of the other dictionary (database). My situation was one file sync successfully and sometimes second fail due to week signal.
Thank you again
Disala
aaronw wrote: May 11th, 2021, 11:22 am
I don't believe there is a way to access logic after the case-confirmation button has been confirmed. My suggestion is to not recreate the person count in household, because the challenge then becomes keeping it in sync. Instead, access the person data as an external dictionary in the household application when needed.
Re: Update external database when save success
Posted: May 13th, 2021, 3:43 am
by emdisala
Dear Gregory
Thank you for your guidance. All your comments are very important and valuable to go further.
At this point let me raise a question just came in … and solve issues with above mention sync of two separate files as well to get more knowledge in CSPro ...
Is it possible to merge two separate dictionaries (data) into one which has both dictionaries items in
android.
(Similar to CSENTY (Windows) merge .DAT files and do a sort with sort data tool (sort type / Record sort / HH Identification ,<record type>) )
Thank you again
Disala
Gregory Martin wrote: May 12th, 2021, 2:21 pm
Whether or not it is a good idea to have variables that you have to keep in sync, you can always turn off "Confirm end-of-case" here:
https://www.csprousers.org/help/CSPro/c ... tions.html
Then, instead of using CSEntry's default confirmation, you could add an item to your dictionary and create your own confirmation screen. Then, in the postproc of that confirmation, you could update your external databases.
For all of my projects I turn off this confirmation and use my own as I prefer being able to customize the confirmation text that is presented to enumerators.
Re: Update external database when save success
Posted: May 13th, 2021, 7:47 am
by Gregory Martin
Starting with CSPro 7.6, you can run Sort Data applications on Android. So you can create the specification and PFF files that define your sort, and then either run it as an application (the PFF will show on the applications screen), or you can run it from a menu program using execpff or pff.exec.
Re: Update external database when save success
Posted: May 13th, 2021, 12:51 pm
by emdisala
Dear Gregory,
Sounds good. Thank you for your information. Need to experiment and find easy way to merger two separate CSDBs to one if possible as DATs and apply sort.
Disala
Gregory Martin wrote: May 13th, 2021, 7:47 am
Starting with CSPro 7.6, you can run Sort Data applications on Android. So you can create the specification and PFF files that define your sort, and then either run it as an application (the PFF will show on the applications screen), or you can run it from a menu program using execpff or pff.exec.
Re: Update external database when save success
Posted: May 14th, 2021, 8:41 am
by Gregory Martin
You can also run the Concatenate Data tool on Android. So you could:
1) Concatenate the two CSPro DB files into a single text file.
2) Do your sort.