Creating unique ID from the available variables using calculate

I have made a unique id by using note.
uniqueid1


But this note value is not going to the server.
uniqueid-xls
So actually I want my note value will go to the server (with “/”), like this picture.
uniqueid-actual%20I%20need%20this

Thank You.

Question labels, eg “unique id id: ${id}/${name}/${gender}” are only displayed in the form; question labels are not submitted as part of the submission payload, hence they will not show up on the server.

What you need to do is create a separate calculation; eg

type=text, name=unique_id, calculation=concat(${id}, '/', ${name}, '/', ${gender})
type=note, label="unique id is: ${unique_id}

This way the property ${unique_id} will be submitted as a result and should appear as a separate field on the server.

1 Like

@Xiphware. Thanks a lot. It works perfectly.

@Xiphware, I have an issue. When I make a group of those questionnaires, It doesn’t work on odk collect of mobile, But it works on KoBoToolbox online preview. But when I delete the group then it works perfectly on mobile. So I have an issue with using mobile. Do you know anything?
Here is the web preview (It works perfectly even made group):


Here is a mobile preview (doesn’t work when creating a group, but data go to the server):

Thank You

The problem you are seeing is a result of a long-standing issue in Collect that questions on the same page (ie in a group field-list) are not updated when other questions on the same page upon which they depend change value, as is the case with your Uniquid ID. So the “//” shown is simply the initial value when the page is first displayed, which is not subsequently changed as you enter values (but if you go forward and back you should see the updated value…)

This issue was fixed in ODK Collect v1.22. See https://github.com/opendatakit/collect/issues/378

So either you need to update your version of Collect, or alternatively you must display your Unique ID outside after the field-list group.

1 Like

Thanks, Mr. @Xiphware. My ‘ODK Collect’ app is up to date. My version is: 1.23.3
So it’s over than v1. 22. So it seems to work well. But the shocking matter that, it is not working

Can you please post your exact form to help debug, thnx

Thanks @Xiphware. Here is the xls file: Unique-ID.xls (25.5 KB)

It works on KoBoToolbox web preview. But not working (Live Update) with the Android Mobile (ODK Collect v1.24.0)

Check this XLSFormUnique-ID.xls (61 KB)

Thanks @azadkhan. It works on web preview, but not working (Live Result) on Android “ODK Collect” app.

Hi @tanzilhuda,

Please see the attached (slightly edited and refined version) xlsform where @Xiphware and @azadkhan had contributed significantly. It should now work smoothly even in the group in Enketo, KoBoCollect as well as ODKCollect.

In the survey tab of the xlsform:

In the choices tab of the xlsform:
Image%202

Screenshot on KoBoCollect:

Reference xlsform:
Unique-ID.xls (26.5 KB)

GOOD DAY!

Thanks a lot @Kal_Lam. It works perfectly. But It creates an extra column for the note in the result excel sheet. But anyway, it works perfectly. So much Thank You,

2 Likes

to avoid repeat number in id which lead to error Unique ID, is there any way that kobo could alert survey respondent?

Hello @azadkhan and all. Thank you for the amazing assistance you all are providing. I want to unique ID from the below condition:
Q1 - UC - (4 select-one options i.e., A=1, B=2, C=3, D=4)
Unique ID: I want the first part of UC and then auto-generate number. If the enumerator select A and the house is the first one then the Unique ID should be 1-1, if 2nd house then 1-2. But if he selects B and the House number is 3 then the Unique ID should be 2-1.

It is OK if the Unique ID is generated after submitting the form. I want it in the downloaded sheet.

Thank you for your assistance in this regard