i have created a form that has a counter that will increment whenever the form is opened, my problem is the form is in a case sharing mode which leads to wrong results when the multiple mobile workers open the form offline from different devices which confuse the counter and let to the counter to count the latest submission and neglect the other submission which leads to incorrect result each time.
for example the counter reached number 5 when the two devices synced last time and the device A will submit two forms which will get the counter to 7 but the other device then submit a form and the counter is currently 5 (because this was the number reached for the counter during the last sync) which it will lead for the counter to be 6 and when both tablets will get online the commcare will neglect one of them and use only one.
what can i do to avoid this situation, can i force each tablet to do a sync before or after the form submission or is there any other way to solve the situation.
Could you please explain what you are trying to accomplish with the counter at a high level?
hi Dev and thanks for your respond,
i have created an application for attendance for one of our organization activities so the counter is all what the form about as it gives me how many sessions each child has attended by the end of the activity but the problem is the facilitators dont sync there tablets which it lead for multiple submissions offline which it will give wrong result so i need to make the sync required after or before the form submission or if there is other way to deal with the issue you can recommend.
Why don’t you look at the Form Data Export for that form to understand the number of times it was submitted for a given case? Each form submission in the Form Data Export has a column called Case Name, which is the name of the case the form operated on.
You are right that your current approach will lead to bad data due to case sharing and users submitting the same form for the same case at different timings.