Adding +1 to hidden value for every succesfull form submission

Hi All,

we are collecting one form at each meeting and want to record the meeting number for each form. In the past we had issues with staff manually entering this field though. hence, we are currently working with 2 hidden values where the 2nd one is referencing the first one as follows:
meeting_number_hidden = coalesce(#case/meeting_number, 0) + 1

the problem is that for some reason meeting number is now higher than the actual form submission. I am suspecting that meeting number is also increasing when staff is re-opening or changing information in a given case after the initial submission.

this is causing some issues with our data. anybody with an idea how else to count meetings or form submissions?

thanks,

Robert

Hi I really need some help on this one…

any ideas? does my problem makes sense or is some clarification needed?

thanks in advance to whoever can help me on this one…

Robert

still nothing?

I guess we are resorting to manual entry of the meeting count.

Hi Robert,

The syntax you described sounds like the correct way to implement this behavior.

I’m actually not sure how you would end up in a situation where the case counter was higher than the form submission - I’d expect the opposite behavior (case counter being lower than the form submission) which can be caused when the case is updated simultaneously or via incomplete forms.

Do you use Edit Forms? This could cause the issues you’re describing. If not, I’d recommend walking through the case update history to see where the value is being (erroneously) over-incremented.

Cheers,
Will

Hi Robert,

The workflow you’re describing should work, and is commonly-used by other CommCare app builders. The most common cause of the discrepancy you’re seeing would be that there are forms that were completed by a mobile user on their device, but did not make it to the server for some reason. This could be either because something about the form became corrupted, or the user manually deleted or archived the form. Whatever the cause, if that were to happen, then you would have a situation where the meeting numbers of the forms on HQ would appear to “skip” at the point of the missing form.

It can be quite tricky to determine definitively if this is happening, but if you have a relatively small workforce, you can have each of your users check to see if there are any quarantined forms on their device by taking the steps outlined here.