ODK labels instead name codes

1. What is the issue? Please be detailed.

I have developed a ODK Form using excel sheet , then convert to xml using online ODK , now the issue is , when I upload the data to the server, select one and select_multiple will only get values from name codes, I want the Labels , so After I used the jr:choice-name() function , now both values get stored to the server , meaning I get an extra field for what I am looking for which is the label value and also I still get the name code ,

2. What steps can we take to reproduce this issue?

4. Upload any forms or screenshots you can share publicly below.

Hi @Tangi

A warm welcome to the ODK community! Please take a moment to introduce yourself. Please also use a photo of yourself as an Avatar, it will help build community.

This sounds like a clever solution/work-around to this known issue that ODK Central only provides the field names, and not the labels?

If you're using selects built into the form, you can specify the same text for name and label. You'll still need to define both columns but they can be identical.

A strategy that only works with attached files, not inline selects If the labels provide enough information to uniquely identify the items that are being selected, you could use the `parameters` column to use the same column for both label and value as documented [here](https://docs.getodk.org/form-question-types/#customizing-label-and-value).

Select multiple values are stored as space-separated lists so make sure that the labels you save don't include spaces. This only works for single selects, not for select multiple.

I'm curious to know more about why you absolutely don't want this extra column. Is it because it feels messy to capture data you don't want or is there some other reason? For example, are you trying to keep the data transferred to your PowerBI dashboard as minimal possible? Are you using the exported CSV without any further processing?

Hi @LN

Thanks for responding , the extra column I was referring to is ; for example , you have survey sheet and choices sheet with data , some of which are drop down , meaning you need to use select_one function and select_multiple function,

now in choices sheets , you will have to have list_name , name, and label fields ,and give codes under the field "name " while actual values or label data are under label ,

The challenge is , when you capture your data and store to the server , lets say google sheet, you will get the codes there instead of label values, and if you use calculate and use r:choice-name() function , then the output will be the results you want , which is the label data and still the code value that you wanted to get rid of from the first place

Kindly refer to the screenshot here ;

Thanks

basically , if you choose northern area hospital , you will get fac1 as data stored to the server, if you use jr:choice-name then you still get fac1 under fac_name field and northern area hospital under facility_label , just imagine if you have many fields from select_one or select_multiple , these extra fields are not needed

Yes, that's fair.

I edited my post above but you may not have seen it. I'd recommend putting the exact same value in name and label if you have no intention to use codes in your analysis. You can use a spreadsheet formula to make sure they stay synchronized. For example, set the label as you want it, and in name, type = and then click on the corresponding label column. You can drag this formula down so all items use it.

This will always work with select ones. With select multiples, make sure that the values you set for name have no spaces in them because selected values are separated by spaces. For example, you might get the value Northern Area hospital Rural clinic Private Medical Centre which would be hard to use in analysis. This is why there's typically a difference between name and label -- label values are convenient for humans but it's easier to do automated analysis with short codes that are guaranteed to be unique.

For this i use the an expression with SUBSTITUTE to replace spaces with either _ or • to populate the name column in the form, then reverse this with my submitted data.

2 Likes