# Generate a primary key using device id n other values as a primary key

**URL:** <https://forum.getodk.org/t/generate-a-primary-key-using-device-id-n-other-values-as-a-primary-key/2115>\
**Category:** Support\
**Created:** [April 15, 2013, 8:08am UTC](https://forum.getodk.org/t/generate-a-primary-key-using-device-id-n-other-values-as-a-primary-key/2115 "2013-04-15T08:08:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Coulson\_Thabo\_Kgathi](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/c/f07891/32.png) [@Coulson\_Thabo\_Kgathi](https://forum.getodk.org/u/Coulson_Thabo_Kgathi)\
**Post date:** [April 15, 2013, 8:08am UTC](https://forum.getodk.org/t/generate-a-primary-key-using-device-id-n-other-values-as-a-primary-key/2115/1 "2013-04-15T08:08:29Z")

</div>

hi giuys i would like to generate a primary key using he device id and  
other values such that they wont be the same with others fwom other devices

---

<div class="post-metadata">

**Author:** ![Nik\_Go](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/n/50afbb/32.png) [@Nik\_Go](https://forum.getodk.org/u/Nik_Go)\
**Post date:** [April 15, 2013, 9:43am UTC](https://forum.getodk.org/t/generate-a-primary-key-using-device-id-n-other-values-as-a-primary-key/2115/2 "2013-04-15T09:43:59Z")

</div>

You can:

calculate="uuid()"

to generate a unique identifier for each instance.

> **···**
>
> On Monday, April 15, 2013, Coulson Thabo Kgathi wrote:
> 
> > hi giuys i would like to generate a primary key using he device id and  
> > other values such that they wont be the same with others fwom other devices
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com) \<javascript:\_e({}, 'cvml',  
> > 'opendatakit@googlegroups.com');\>  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com) \<javascript:\_e({},  
> > 'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');\>  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com) \<javascript:\_e({},  
> > 'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
