Select to view content in your preferred language

Survey123 autoincrement

993
6
06-03-2022 01:57 PM
by Anonymous User
Not applicable

I'm using Survey123 to create a survey form which will allow the user to capture coordinates and then take photos at multiple sites.

Is it possible to set an autoincrement inside a repeat so that each site would have a number and each photo taken at that site would also have a number?

Site 1, photo 1; Site 1, photo 2; Site 2, photo 1, etc.

Thanks.

Rob..

0 Kudos
6 Replies
LaurenceTait
Frequent Contributor

That depends on what precisely you mean.

It's easy enough to give each site a number and each photo within a site. See the attached XLSX form for a working example.

However the way that Survey123 works, the actual output will have a separate record for each site, and the [photo number] field will always be simply the maximum number of images.

There are two options to achieve what you want.

The first is to use the Beta version, which allows you to choose the name images are stored with. If you use this option, the photos will be automatically saved as "Site 1 photo 1.jpg ", "Site 1 photo 2.jpg" and so forth. I've included this functionality in the example above, but if you aren't using the latest beta version, it won't work.

The other option requires you to put the photos in their own repeat - ie a repeat within a repeat. If you do that, then every photo will be saved as its own record with its own record number.

0 Kudos
by Anonymous User
Not applicable

I've used the syntax in your form exactly as you provided so thanks very much for that.

I was getting an ODK Validate Error at first but it seems to be working now, not sure what I did but it's working.

Thank you.

0 Kudos
by Anonymous User
Not applicable

now my issue is getting the increments to show in the report as Site 1 Photo 1, Site 1 Photo 2, etc.

0 Kudos
LaurenceTait
Frequent Contributor

Do you have the latest Beta version of  Connect installed (version 3.14)?

0 Kudos
by Anonymous User
Not applicable

I'm on 3.12.232.

Does 3.14 offer different functionality?

0 Kudos
by Anonymous User
Not applicable

I've now installed 3.14 and attempting to follow the suggested syntax but without success.

0 Kudos