Get consecutive id number in form before submission (or in offline mode)


I’m trying to make a form for registering patients in a field hospital, in a mostly offline environment.
In that case, I would need a consecutive id number for each patient, and it would be optimal if I could get it before submitting de info (or after, but in an offline environment).

I don’t know if that’s possible, for what I’ve read I haven’t found a solution.

Thank you very much.

Welcome to the community, @wodbow! Maybe you could do it as outlined in the support article Creating Unique Serial Numbers in Forms.

Thanks for such a quick response!

That’s not exactly what I’m looking for, as my goal is to start with patient number 1 for the first submission, and get consecutive numbers for the next patients.

“Calculate” function can get me a unique id for each registration, but for what I’ve seen it cannot be a simple consecutive series. Am I wrong?

Thanks again for the attention.

Sorry to inform you that this feature at the moment is not available with KoBoToolbox. Maybe you could mange it by providing the serial numbers manually.

Thanks again for your kind help, I think I will adopt the manual solution for now.

Have a nice day!

Hi @wodbow, if you are going to be collecting data from a single device, you can increment an ID using the last-saved feature as follows:


type name label default
integer id Client ID if(${last-saved#id} = ‘’, 1, ${last-saved#id} + 1)
text name What is your name?

Note that this will not increment the ID across multiple devices. This feature is also not yet available on the OCHA server until Enketo is upgrade next week:

1 Like