Auto generate a field to be used as a primary key

Hi guys i want to generate a field value for a form to use it as a primary
key later.

the value of the field may be a "device id"+"a sequential value"+"some
other value"

i wonder if the is a way i could get the value of the device id of the
android device i collect information with, or maybe even the login id

··· On Tuesday, May 7, 2013 4:16:16 PM UTC+2, Coulson Thabo Kgathi wrote: > > Hi guys i want to generate a field value for a form to use it as a primary > key later. > > the value of the field may be a "device id"+"a sequential value"+"some > other value" >

You may use uuid() + today() + now() to get the sequence in order (if
that's the purpose of your "sequential value")

uuid() returns a UUID, today() returns the system date, and now() the
system time.

Check this page for bindings reference:
http://opendatakit.org/help/form-design/binding/

Nik

··· On Tuesday, May 7, 2013, Coulson Thabo Kgathi wrote:

Hi guys i want to generate a field value for a form to use it as a primary
key later.

the value of the field may be a "device id"+"a sequential value"+"some
other value"

--

Post: opendatakit@googlegroups.com <javascript:_e({}, 'cvml',
'opendatakit@googlegroups.com');>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');>
Options: 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 <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');>.
For more options, visit https://groups.google.com/groups/opt_out.

Nik, can you confirm that functionality for now()? I have not had it work
like that for me and would be happy if it did.

In my experience using xlsform it just provides today's date. If you
change the type to datetime in the xml it provides a date and time stamp of
the first time it is called, but not an accurate instantaneous timestamp
(calling it 3 times over the course of a survey will supply the same exact
date and time 3 times...).

Let me know if you've had different results.

Jason

··· On Tuesday, May 7, 2013 10:41:59 AM UTC-4, ニコノコ wrote: > > > You may use uuid() + today() + now() to get the sequence in order (if > that's the purpose of your "sequential value") > > uuid() returns a UUID, today() returns the system date, and now() the > system time. > > Check this page for bindings reference: > http://opendatakit.org/help/form-design/binding/ > > Nik > > On Tuesday, May 7, 2013, Coulson Thabo Kgathi wrote: > >> Hi guys i want to generate a field value for a form to use it as a >> primary key later. >> >> the value of the field may be a "device id"+"a sequential value"+"some >> other value" >> >> -- >> -- >> Post: opendatakit@googlegroups.com >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> Options: 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. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >

I remember that the uuid() is only generated once per instance, so calling
it several times will produce the same result every time.

I confirm that the now() function behaves the same way, and is unexpted.

··· On Thursday, May 9, 2013, Jason Ives wrote:

Nik, can you confirm that functionality for now()? I have not had it work
like that for me and would be happy if it did.

In my experience using xlsform it just provides today's date. If you
change the type to datetime in the xml it provides a date and time stamp of
the first time it is called, but not an accurate instantaneous timestamp
(calling it 3 times over the course of a survey will supply the same exact
date and time 3 times...).

Let me know if you've had different results.

Jason

On Tuesday, May 7, 2013 10:41:59 AM UTC-4, ニコノコ wrote:

You may use uuid() + today() + now() to get the sequence in order (if
that's the purpose of your "sequential value")

uuid() returns a UUID, today() returns the system date, and now() the
system time.

Check this page for bindings reference: http://opendatakit.**
org/help/form-design/binding/http://opendatakit.org/help/form-design/binding/

Nik

On Tuesday, May 7, 2013, Coulson Thabo Kgathi wrote:

Hi guys i want to generate a field value for a form to use it as a
primary key later.

the value of the field may be a "device id"+"a sequential value"+"some
other value"

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@**googlegroups.com
Options: http://groups.google.com/**group/opendatakit?hl=enhttp://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.
For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
.

--
--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: 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.
For more options, visit https://groups.google.com/groups/opt_out.

Nik,

Clayton (of Dimagi) has a patch that fixes the uuid() and random()
bug. The patch should land in the core soon.

The now() bug has been on my todo list for a while. I will take a look
when I get some time.

Yaw

··· -- Need ODK help? Go to http://nafundi.com for custom features, form design, implementation support, and user training for ODK.

On Wed, May 8, 2013 at 5:43 PM, ゴー・ニコライ nikolai.go@gmail.com wrote:

I remember that the uuid() is only generated once per instance, so calling
it several times will produce the same result every time.

I confirm that the now() function behaves the same way, and is unexpted.

On Thursday, May 9, 2013, Jason Ives wrote:

Nik, can you confirm that functionality for now()? I have not had it work
like that for me and would be happy if it did.

In my experience using xlsform it just provides today's date. If you
change the type to datetime in the xml it provides a date and time stamp of
the first time it is called, but not an accurate instantaneous timestamp
(calling it 3 times over the course of a survey will supply the same exact
date and time 3 times...).

Let me know if you've had different results.

Jason

On Tuesday, May 7, 2013 10:41:59 AM UTC-4, ニコノコ wrote:

You may use uuid() + today() + now() to get the sequence in order (if
that's the purpose of your "sequential value")

uuid() returns a UUID, today() returns the system date, and now() the
system time.

Check this page for bindings reference:
http://opendatakit.org/help/form-design/binding/

Nik

On Tuesday, May 7, 2013, Coulson Thabo Kgathi wrote:

Hi guys i want to generate a field value for a form to use it as a
primary key later.

the value of the field may be a "device id"+"a sequential value"+"some
other value"

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: 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.
For more options, visit https://groups.google.com/groups/opt_out.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: 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.
For more options, visit https://groups.google.com/groups/opt_out.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: 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.
For more options, visit https://groups.google.com/groups/opt_out.

Thank you Yaw

··· On Thursday, May 9, 2013, Yaw Anokwa wrote:

Nik,

Clayton (of Dimagi) has a patch that fixes the uuid() and random()
bug. The patch should land in the core soon.

The now() bug has been on my todo list for a while. I will take a look
when I get some time.

Yaw

Need ODK help? Go to http://nafundi.com for custom features, form
design, implementation support, and user training for ODK.

On Wed, May 8, 2013 at 5:43 PM, ゴー・ニコライ nikolai.go@gmail.com wrote:

I remember that the uuid() is only generated once per instance, so
calling
it several times will produce the same result every time.

I confirm that the now() function behaves the same way, and is unexpted.

On Thursday, May 9, 2013, Jason Ives wrote:

Nik, can you confirm that functionality for now()? I have not had it
work

like that for me and would be happy if it did.

In my experience using xlsform it just provides today's date. If you
change the type to datetime in the xml it provides a date and time
stamp of

the first time it is called, but not an accurate instantaneous timestamp
(calling it 3 times over the course of a survey will supply the same
exact

date and time 3 times...).

Let me know if you've had different results.

Jason

On Tuesday, May 7, 2013 10:41:59 AM UTC-4, ニコノコ wrote:

You may use uuid() + today() + now() to get the sequence in order (if
that's the purpose of your "sequential value")

uuid() returns a UUID, today() returns the system date, and now() the
system time.

Check this page for bindings reference:
http://opendatakit.org/help/form-design/binding/

Nik

On Tuesday, May 7, 2013, Coulson Thabo Kgathi wrote:

Hi guys i want to generate a field value for a form to use it as a
primary key later.

the value of the field may be a "device id"+"a sequential value"+"some
other value"

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: 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.
For more options, visit https://groups.google.com/groups/opt_out.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: 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.
For more options, visit https://groups.google.com/groups/opt_out.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

Thanks for checking it Nik, and thanks for the update Yaw.

Jason

··· On Thursday, May 9, 2013 7:50:51 AM UTC-4, ニコノコ wrote: > > Thank you Yaw > > On Thursday, May 9, 2013, Yaw Anokwa wrote: > >> Nik, >> >> Clayton (of Dimagi) has a patch that fixes the uuid() and random() >> bug. The patch should land in the core soon. >> >> The now() bug has been on my todo list for a while. I will take a look >> when I get some time. >> >> Yaw >> -- >> Need ODK help? Go to http://nafundi.com for custom features, form >> design, implementation support, and user training for ODK. >> >> On Wed, May 8, 2013 at 5:43 PM, ゴー・ニコライ wrote: >> > I remember that the uuid() is only generated once per instance, so >> calling >> > it several times will produce the same result every time. >> > >> > I confirm that the now() function behaves the same way, and is unexpted. >> > >> > >> > On Thursday, May 9, 2013, Jason Ives wrote: >> >> >> >> Nik, can you confirm that functionality for now()? I have not had it >> work >> >> like that for me and would be happy if it did. >> >> >> >> In my experience using xlsform it just provides today's date. If you >> >> change the type to datetime in the xml it provides a date and time >> stamp of >> >> the first time it is called, but not an accurate instantaneous >> timestamp >> >> (calling it 3 times over the course of a survey will supply the same >> exact >> >> date and time 3 times...). >> >> >> >> Let me know if you've had different results. >> >> >> >> Jason >> >> >> >> On Tuesday, May 7, 2013 10:41:59 AM UTC-4, ニコノコ wrote: >> >>> >> >>> >> >>> You may use uuid() + today() + now() to get the sequence in order (if >> >>> that's the purpose of your "sequential value") >> >>> >> >>> uuid() returns a UUID, today() returns the system date, and now() the >> >>> system time. >> >>> >> >>> Check this page for bindings reference: >> >>> http://opendatakit.org/help/form-design/binding/ >> >>> >> >>> Nik >> >>> >> >>> On Tuesday, May 7, 2013, Coulson Thabo Kgathi wrote: >> >>>> >> >>>> Hi guys i want to generate a field value for a form to use it as a >> >>>> primary key later. >> >>>> >> >>>> the value of the field may be a "device id"+"a sequential >> value"+"some >> >>>> other value" >> >>>> >> >>>> -- >> >>>> -- >> >>>> Post: opendatakit@googlegroups.com >> >>>> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> >>>> Options: 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. >> >>>> For more options, visit https://groups.google.com/groups/opt_out. >> >>>> >> >>>> >> >> >> >> -- >> >> -- >> >> Post: opendatakit@googlegroups.com >> >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> >> Options: 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. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >> >> > >> > -- >> > -- >> > Post: opendatakit@googlegroups.com >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> > Options: > >