Constraints on date and age

Hi all!
I've checked the forum in vain, I'm still not happy.
I need to collect data for children aged 2mo - 5 yrs at inclusion. If the exact date of birth is unknown we mark 09-09-2099 and write the approximate age in months.
I tried the enclosed example. I've checked the date() and decimal-date() functions but they didn't work.
What's wrong with my formula? How to proceed?
Many thanks.

Serge

Date_Age.xls.xlsx (10.6 KB)

Serge,

What precisely is wrong with the form

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Tue, Sep 16, 2014 at 7:05 AM, Serge Somda manituo@gmail.com wrote:

Hi all!
I've checked the forum in vain, I'm still not happy.
I need to collect data for children aged 2mo - 5 yrs at inclusion. If the exact date of birth is unknown we mark 09-09-2099 and write the approximate age in months.
I tried the enclosed example. I've checked the date() and decimal-date() functions but they didn't work.
What's wrong with my formula? How to proceed?
Many thanks.

Serge

--

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/d/optout.

Serge, you could also add a Yes/no Question "Do you know DOB" and then if the answer is "NO" just don't show the enter date prompt...

1 -> The default date of birth works on enketo but not on odk collect
2 -> The date of birth '09/09/2099' is considered as an illegal value
3 -> Naturally the relevant field for the age does not work
4 -> The age is not automatically computed.

Regards.

Serge

··· 2014-09-16 16:08 GMT+02:00 Yaw Anokwa :

Serge,

What precisely is wrong with the form

Yaw

Need ODK services? http://nafundi.com provides form design, server
setup, professional support, and software development for ODK.

On Tue, Sep 16, 2014 at 7:05 AM, Serge Somda manituo@gmail.com wrote:

Hi all!
I've checked the forum in vain, I'm still not happy.
I need to collect data for children aged 2mo - 5 yrs at inclusion. If
the exact date of birth is unknown we mark 09-09-2099 and write the
approximate age in months.
I tried the enclosed example. I've checked the date() and decimal-date()
functions but they didn't work.
What's wrong with my formula? How to proceed?
Many thanks.

Serge

--

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/d/optout.

--

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 a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/SQJpH9ZBmQY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
M. Aymar Serge SOMDA, BEng. MMath. MSPH.
Méthodologiste - Biostatisticien
*
Chef Unité de Formation et d'Appui Méthodologique
Centre MURAZ
Bur: (226) 20 97 01 02 Poste 438
GSM: (226) 70 44 33 22
Bobo Dioulasso, Burkina Faso
Email: serge.somda@centre-muraz.bf
http://www.centre-muraz.bf/

Cellule de Biostatistique
Institut Universitaire du Cancer
Toulouse - Oncopole
Bur: (33) (0)531 155 860
GSM: (33) (0)604 521 773
Toulouse, France
Email: somda.serge@iuct-oncopole.fr
http://www.oncopole-toulouse.com/

Yeah. That's a great idea.
So I imagine everything is now solved.
This forum is really great.

Thanks a lot.

Serge

··· 2014-09-17 10:16 GMT+02:00 :

Serge, you could also add a Yes/no Question "Do you know DOB" and then if
the answer is "NO" just don't show the enter date prompt...

--

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 a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/SQJpH9ZBmQY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
M. Aymar Serge SOMDA, BEng. MMath. MSPH.
Méthodologiste - Biostatisticien
*
Chef Unité de Formation et d'Appui Méthodologique
Centre MURAZ
Bur: (226) 20 97 01 02 Poste 438
GSM: (226) 70 44 33 22
Bobo Dioulasso, Burkina Faso
Email: serge.somda@centre-muraz.bf
http://www.centre-muraz.bf/

Cellule de Biostatistique
Institut Universitaire du Cancer
Toulouse - Oncopole
Bur: (33) (0)531 155 860
GSM: (33) (0)604 521 773
Toulouse, France
Email: somda.serge@iuct-oncopole.fr
http://www.oncopole-toulouse.com/

Hi Serge,

When troubleshooting, break down the problem into smaller chunks. I
find that, plus a combination of debug variables using calculates and
outputs helps a lot. I found five problems with your form.

  1. The date format you use is not correct. "2014-12-31" is the correct format.
  2. When you subtract days from dates, wrap the operation like so:
    "date(${date_obs} - 60)"
  3. Division is done with div, not /. For example, "10 div 2" will give you 5.
  4. Defaults cannot contain variables or commands. If you want get
    dynamic 'default', use the calculation column.
  5. Age should probably be an integer since div will give you an overly
    precise number (e.g, 12.21321412512)

Attached is a form that solves the above issues. Many of these issues
could have been fixed by going through the resources at
http://xlsform.opendatakit.org and
http://opendatakit.org/help/form-design/binding. I encourage you to
look through the above links for further guidance.

As to things that don't work with enketo, ask on
https://groups.google.com/forum/#!forum/enketo-users.

Yaw

date.xlsx (29 KB)

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Tue, Sep 16, 2014 at 7:19 AM, M. A. Serge SOMDA manituo@gmail.com wrote:

1 -> The default date of birth works on enketo but not on odk collect
2 -> The date of birth '09/09/2099' is considered as an illegal value
3 -> Naturally the relevant field for the age does not work
4 -> The age is not automatically computed.

Regards.

Serge

2014-09-16 16:08 GMT+02:00 Yaw Anokwa yanokwa@nafundi.com:

Serge,

What precisely is wrong with the form

Yaw

Need ODK services? http://nafundi.com provides form design, server
setup, professional support, and software development for ODK.

On Tue, Sep 16, 2014 at 7:05 AM, Serge Somda manituo@gmail.com wrote:

Hi all!
I've checked the forum in vain, I'm still not happy.
I need to collect data for children aged 2mo - 5 yrs at inclusion. If
the exact date of birth is unknown we mark 09-09-2099 and write the
approximate age in months.
I tried the enclosed example. I've checked the date() and decimal-date()
functions but they didn't work.
What's wrong with my formula? How to proceed?
Many thanks.

Serge

--

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/d/optout.

--

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 a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/SQJpH9ZBmQY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
M. Aymar Serge SOMDA, BEng. MMath. MSPH.
Méthodologiste - Biostatisticien
*
Chef Unité de Formation et d'Appui Méthodologique
Centre MURAZ
Bur: (226) 20 97 01 02 Poste 438
GSM: (226) 70 44 33 22
Bobo Dioulasso, Burkina Faso
Email: serge.somda@centre-muraz.bf
http://www.centre-muraz.bf/

Cellule de Biostatistique
Institut Universitaire du Cancer
Toulouse - Oncopole
Bur: (33) (0)531 155 860
GSM: (33) (0)604 521 773
Toulouse, France
Email: somda.serge@iuct-oncopole.fr
http://www.oncopole-toulouse.com/

--

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/d/optout.

2 Likes

Wonderfull. Several points have been solved.
But the legal value "2099-09-09" still doesn't work. This works properly on
enketo but not with ODK collect.
A widget is displayed and when I enter "09 -- sep -- 2099" it returns the
error message.
Is it possible to force a simple date entry "2099-09-09" in the place of
the widget, this would be simpler.

Many thanks.

Serge

··· 2014-09-17 8:42 GMT+02:00 Yaw Anokwa :

Hi Serge,

When troubleshooting, break down the problem into smaller chunks. I
find that, plus a combination of debug variables using calculates and
outputs helps a lot. I found five problems with your form.

  1. The date format you use is not correct. "2014-12-31" is the correct
    format.
  2. When you subtract days from dates, wrap the operation like so:
    "date(${date_obs} - 60)"
  3. Division is done with div, not /. For example, "10 div 2" will give you
  4. Defaults cannot contain variables or commands. If you want get
    dynamic 'default', use the calculation column.
  5. Age should probably be an integer since div will give you an overly
    precise number (e.g, 12.21321412512)

Attached is a form that solves the above issues. Many of these issues
could have been fixed by going through the resources at
http://xlsform.opendatakit.org and
http://opendatakit.org/help/form-design/binding. I encourage you to
look through the above links for further guidance.

As to things that don't work with enketo, ask on
https://groups.google.com/forum/#!forum/enketo-users.

Yaw

Need ODK services? http://nafundi.com provides form design, server
setup, professional support, and software development for ODK.

On Tue, Sep 16, 2014 at 7:19 AM, M. A. Serge SOMDA manituo@gmail.com wrote:

1 -> The default date of birth works on enketo but not on odk collect
2 -> The date of birth '09/09/2099' is considered as an illegal value
3 -> Naturally the relevant field for the age does not work
4 -> The age is not automatically computed.

Regards.

Serge

2014-09-16 16:08 GMT+02:00 Yaw Anokwa yanokwa@nafundi.com:

Serge,

What precisely is wrong with the form

Yaw

Need ODK services? http://nafundi.com provides form design, server
setup, professional support, and software development for ODK.

On Tue, Sep 16, 2014 at 7:05 AM, Serge Somda manituo@gmail.com wrote:

Hi all!
I've checked the forum in vain, I'm still not happy.
I need to collect data for children aged 2mo - 5 yrs at inclusion. If
the exact date of birth is unknown we mark 09-09-2099 and write the
approximate age in months.
I tried the enclosed example. I've checked the date() and
decimal-date()

functions but they didn't work.
What's wrong with my formula? How to proceed?
Many thanks.

Serge

--

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/d/optout.

--

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 a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/SQJpH9ZBmQY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
M. Aymar Serge SOMDA, BEng. MMath. MSPH.
Méthodologiste - Biostatisticien
*
Chef Unité de Formation et d'Appui Méthodologique
Centre MURAZ
Bur: (226) 20 97 01 02 Poste 438
GSM: (226) 70 44 33 22
Bobo Dioulasso, Burkina Faso
Email: serge.somda@centre-muraz.bf
http://www.centre-muraz.bf/

Cellule de Biostatistique
Institut Universitaire du Cancer
Toulouse - Oncopole
Bur: (33) (0)531 155 860
GSM: (33) (0)604 521 773
Toulouse, France
Email: somda.serge@iuct-oncopole.fr
http://www.oncopole-toulouse.com/

--

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/d/optout.

--

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 a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/SQJpH9ZBmQY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
M. Aymar Serge SOMDA, BEng. MMath. MSPH.
Méthodologiste - Biostatisticien
*
Chef Unité de Formation et d'Appui Méthodologique
Centre MURAZ
Bur: (226) 20 97 01 02 Poste 438
GSM: (226) 70 44 33 22
Bobo Dioulasso, Burkina Faso
Email: serge.somda@centre-muraz.bf
http://www.centre-muraz.bf/

Cellule de Biostatistique
Institut Universitaire du Cancer
Toulouse - Oncopole
Bur: (33) (0)531 155 860
GSM: (33) (0)604 521 773
Toulouse, France
Email: somda.serge@iuct-oncopole.fr
http://www.oncopole-toulouse.com/