Pull out the integer day from a datetime within an xform

Hi,
I was wondering if there was a way in an xform to extract the day from a
datetime field and place it as a new concept.

Specifically what we'd like to do is to have the birthday of a person (in
datetime format) fill in the value for a concept which is just the day of
the birthday e.g. if the birthday is Jan. 4, 1978, the birthday day concept
is 4.

What's happening is that OpenMRS is filling in the full birthday of a
person into the xform, and we would like a validation question to be,
please enter the day of your birthday.

Thanks,

Joaquín

Hey Joaquín,

While the XForms spec does have all sorts of date formatting commands,
most of them are not in JavaRosa. Ditto with the substring() command
which would work as well (see
http://en.wikibooks.org/wiki/XForms/Formatting_a_date for more).

You can either add substring to the core (which would be nice win for
the community) or you can do this processing on the server side. That
is, generate the form such that it only asks for the day, or in the
processing of the submission on the server, you extract the date.

Yaw

··· On Thu, Mar 29, 2012 at 15:52, Joaquín Blaya wrote: > Hi, > I was wondering if there was a way in an xform to extract the day from a > datetime field and place it as a new concept. > > Specifically what we'd like to do is to have the birthday of a person (in > datetime format) fill in the value for a concept which is just the day of > the birthday e.g. if the birthday is Jan. 4, 1978, the birthday day concept > is 4. > > What's happening is that OpenMRS is filling in the full birthday of a person > into the xform, and we would like a validation question to be, please enter > the day of your birthday. > > Thanks, > > Joaquín > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en

Yaw, is there a list of which of the xforms / xpath functions / expressions
are included in javarosa?

··· On Friday, March 30, 2012 12:26:30 AM UTC-4, Yaw Anokwa wrote: > > Hey Joaquín, > > While the XForms spec does have all sorts of date formatting commands, > most of them are not in JavaRosa. Ditto with the substring() command > which would work as well (see > http://en.wikibooks.org/wiki/XForms/Formatting_a_date for more). > > You can either add substring to the core (which would be nice win for > the community) or you can do this processing on the server side. That > is, generate the form such that it only asks for the day, or in the > processing of the submission on the server, you extract the date. > > Yaw > > On Thu, Mar 29, 2012 at 15:52, Joaquín Blaya wrote: > > Hi, > > I was wondering if there was a way in an xform to extract the day from a > > datetime field and place it as a new concept. > > > > Specifically what we'd like to do is to have the birthday of a person (in > > datetime format) fill in the value for a concept which is just the day of > > the birthday e.g. if the birthday is Jan. 4, 1978, the birthday day > concept > > is 4. > > > > What's happening is that OpenMRS is filling in the full birthday of a > person > > into the xform, and we would like a validation question to be, please > enter > > the day of your birthday. > > > > Thanks, > > > > Joaquín > > > > -- > > Post: opendatakit@googlegroups.com > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > Options: http://groups.google.com/group/opendatakit?hl=en > >

The documentation on the JavaRosa side at
https://bitbucket.org/javarosa/javarosa/wiki/xform isn't great -- it
was last updated in 2010, and the core has certainly changed since
then.

We try to put what we know about at
http://opendatakit.org/help/form-design/binding/. As I always say, we
are always looking for help with stuff like this.

··· On Wed, Apr 4, 2012 at 07:14, Prabhas Pokharel wrote: > Yaw, is there a list of which of the xforms / xpath functions / expressions > are included in javarosa? > > > On Friday, March 30, 2012 12:26:30 AM UTC-4, Yaw Anokwa wrote: >> >> Hey Joaquín, >> >> While the XForms spec does have all sorts of date formatting commands, >> most of them are not in JavaRosa. Ditto with the substring() command >> which would work as well (see >> http://en.wikibooks.org/wiki/XForms/Formatting_a_date for more). >> >> You can either add substring to the core (which would be nice win for >> the community) or you can do this processing on the server side. That >> is, generate the form such that it only asks for the day, or in the >> processing of the submission on the server, you extract the date. >> >> Yaw >> >> On Thu, Mar 29, 2012 at 15:52, Joaquín Blaya wrote: >> > Hi, >> > I was wondering if there was a way in an xform to extract the day from a >> > datetime field and place it as a new concept. >> > >> > Specifically what we'd like to do is to have the birthday of a person >> > (in >> > datetime format) fill in the value for a concept which is just the day >> > of >> > the birthday e.g. if the birthday is Jan. 4, 1978, the birthday day >> > concept >> > is 4. >> > >> > What's happening is that OpenMRS is filling in the full birthday of a >> > person >> > into the xform, and we would like a validation question to be, please >> > enter >> > the day of your birthday. >> > >> > Thanks, >> > >> > Joaquín >> > >> > -- >> > Post: opendatakit@googlegroups.com >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> > Options: http://groups.google.com/group/opendatakit?hl=en > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en