I’m building a web map by fetching the data as geojson format from the api. However I do not see the _id or the uuid as properties which is important for me to had some reference by adding more information on a feature when clicked.
On the normal api data export, the _id, _uuid, version, etc. show.
Can someone help me to add the _id to the geojson output or a way to have it in each form submission?
_id and _uuid are metadata and the latter you can reference in your form e.g. to copy them into another variable (using a calculation).
Thanks @wroos. Would you please show me how to copy it in another variabke using a calculation?
You can reference the _uuid value as:
- ${instanceID}
- /data/meta/instanceID.
So, you can create a variable as calculate type (or as string) with one of these expressions as calculation.
Sorry, I didn’t find the way to get/reference the _id value. @Kal_Lam, @Josh, @jnm or @ks_1 might help here, please. _id is probably not available before submission?
“It is literally the primary key of a relational database table.” See Submission duplication after version 2.023.2 - #13 by jnm.
This post (2021) says
`KoBoCAT REST API.json includes the unique _id.
Submission id column missing from API V1 requests - #5 by jnm
Hi @wroos. Thanks for your help.
I inserted for type; calculate, name: unique_uuid, label: unique_uuid and calculation column as ${instanceID}. But after submitting a test form and visualizing the api data, unique_uuid is not there. Am I missing something?
Can you see it
- in the table view
- in modal view
- in the XLS download?
@wroos Hello. I have just submitted a new form and it seems now to work. I can now see the uuid under my unique_uuid variable based on the instanceID. I don’t know why it didn’t work previously, however much thanks for your help.
Please, also test it with editing/save after submission. As far as I know, the _uuid will change then. (The _id won’t.)
There have also been some rare cases where a duplicate _uuid happened. See previous discussion in the forum.
The question how to get/reference the _id is still open, please. @Kal_Lam and the core team might help, please?
You could stop recalculation using once(), but you will reference then always the first version of any edits.
@vick25, could you kindly share with me the following information through a private message so that I can have a closer look at your case (to see if it’s some bug):
- Username
- Project name
- Server
Note: You could share with me a private message as outlined in the post discussed previously:
Hi @Kal_Lam
Username : osfac
Project name: Clone of Initiatives RPF_RDC
Server : kf.kobotoolbox.org