Add a "code" column in the choices sheet

Hello every one.

1. What is the issue? Please be detailed.
It is not really an issue but an "how to" question:
I have "select_one" question. But I also need to store in a different column, a code. I did'nt managed to succeed in XLSForm.

2. What steps can we take to reproduce this issue?
In the "choices" sheet, I had a column "name_CODE". It does not raise any error when I upload the form but the "name_CODE" data is not uploaded in the database

3. What have you tried to fix the issue?
Read the documentation of XLSForm - A research on the forum. Without success

What high-level problem do you want to solve? What kinds of things would be in the name_CODE column?

Thanks for the quick reply.
So, I want to store in ODK central database 2 informations:
The first one, a waste description, given by the data collector with ODK Collect. It is a "select_one" type of question.
The second one, a standardized ID code correspoding to a certain type of waste. I did not want this code included in the list of possible answer. That's why I added a column "name_CODE" to see if this column was added in the ODK Central database.

Why not something like this?

Screen Shot 2022-07-11 at 13.29.44

name (also known as value value) is the code that will be stored in Central and label is what the data collector will see in Collect.

1 Like

Thanks again for the reply.
But I would like to store, in Central, both name and label (in different columns). Is there a way to achieve this ?

Use jr:choice-name to get the label of the choice.

waste.xlsx (10.6 KB)

Hi,

Thanks a lot for the solution. Unfortunatly, I won't be able to try as I am away this week for field work.
But I'm sure that it will work.
Also, I have a piece of (ugly) Python code to delete Project in Central. I started from the example given in the API website, but the urllib2 library is not available anymore in Python3. I used request instead.
I can share it if you want ? (but not until next week).

Julien

Below the piece of python code to delete a project:

import requests

#connection parameters to ODK Central
central_url = "your_url"
central_email = "your_login"
central_password = "your_password"

def delete_project (projectID):
destroy = requests.delete(central_url + "/v1/projects/" + projectID, auth=(central_email, central_password))
print(destroy)