Incremental counter

Hi to everyone, I'm using XlsForm and I have to enter a field that in automatic insert an incremental counter, it's possible? All data will be made by one technician only.

A note for the future: this sort of question belongs in the Support forum. The Development forum is more for people actually trying to work on XLSForm itself, for example.

As for your question: do you mean within a repeat within a form, or do you mean across form submissions? ODK isn't very good at the latter yet.

If you're using Collect, @Grzesiek2010 and @tomsmyth are working on a little external app that will allow you to do this using the external integer widget. It should be available within the next couple of weeks and we will update you here when it is.

4 Likes

Thanks for your answer, I mean across a form submissions; should insert an incremental number whenever the technician create a new form
I have 3 field:
1: incremental counter (number) valid only for one tablet
2: a combobox with the initials of the technician
3: a text field where the first two fields will be united (In this way I could have a field with a unique value for each form)

the problem is the first field

@Grzesiek2010 and @tomsmyth can you provide a short description of the external app that @LN mentioned?

counter-app-specs.xlsx (17.8 KB)

2 Likes

Basic idea is that you send it a form name and question name and it keeps track of a count for you. You can ask it to increment or let the user manually edit the count.

In case you're confused, the "1" button resets the count to 1. We are considering a different icon for that one.

Would it be correct to say that it gives the "Nth" time a survey has been administered on that tablet (for a set period -- since starting at 1)?

Perhaps reset to zero and use a zero button instead of 1? Zero is a common button idiom for eg scales. Just $0.02!

I imagine that would be the most common use case and I think that's what @Gaetano_Patti needs. You can do other interesting things with it like asking enumerators to reset it to 1 in certain conditions (e.g. every hour, after they see a tree with parasite X) or you can count something else by using relevant conditions to only show the counter in certain conditions.

I think that in most cases these counts could be figured out in post-analysis using timestamps for sequencing but there may be reasons that the enumerators themselves need access to the counts. The counts can also be used in, for example, names for filled out forms.

1 Like

For @Gaetano_Patti or anyone who would like to use the counter app described above, it is now available in the Play Store here. Usage instructions and a sample form are available here.

4 Likes

Hello! Could you please tell me please if the is any chance of setting the counter to make an automatic reset for example to a given hour?
Sorry to bump this old post...

Hi @TP
and welcome to the forum! Please introduce yourself here!

if the is any chance of setting the counter to make an automatic reset for example to a given hour?

it is not possible but that app is open source as well you can download it and implement changes you need.

hello, I saw that the answer is old... I would like to know if there is already the possibility of a question of the form type number, with some function inserted, can I make this counter using the "last saved" directly on the form? ?? without needing an external application ? thanks..

Hi @BrunoAngelo,
yes #last-saved should work, but it is "device specific". If you have a team with 2 encounters they will both get an instance sequence from 1 to n...

1 Like

could you kindly tell me how i do it, i don't know how i do it. I just want each form to have a sequential number and to show this number to the user.. seems simple I think..
could you tell me exactly how to do it?
if possible for me it would be easier if you could include the function through "https://build.getodk.org/" but if not if you can tell me how to do this in Xpath it would be great.. thanks for answering I really need to do it this to keep my job safe

Hi @BrunoAngelo
Please try this form:
Autoincrement.xlsx (4.9 KB)

1 Like

I am very grateful indeed...as usually the answers take a few days I managed to do something. however different from the way you presented it.. even so I am very grateful for having answered and provided a valid answer,,