Calculate methods

Hello,

I tried for a long time to find documentation before asking the
community this, but I simply couldn't get it.

I'm trying to figure out what functions I can use in XForms
calculations. I know I can use "if" and "concat", but I"m interested
in using "days-from-date" and "seconds-from-datetime" and other
functions. My forms have so far failed, but this may be because of
other issues. Basically, all I want to do is have a field
automatically populate with the age of a person based on their
birthdate.

I'd appreciate any help you can offer, I'm really stuck right now!

Best,
Nick

hey nick,

unfortunately, we don't have great documentation on which xpath
functions ones work, and which ones don't. for what you are
describing, this age estimating xform at http://pastie.org/2489394
should help.

yaw

··· On Wed, Sep 21, 2011 at 08:49, Nick wrote: > Hello, > > I tried for a long time to find documentation before asking the > community this, but I simply couldn't get it. > > I'm trying to figure out what functions I can use in XForms > calculations. I know I can use "if" and "concat", but I"m interested > in using "days-from-date" and "seconds-from-datetime" and other > functions. My forms have so far failed, but this may be because of > other issues. Basically, all I want to do is have a field > automatically populate with the age of a person based on their > birthdate. > > I'd appreciate any help you can offer, I'm really stuck right now! > > Best, > Nick > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >

Thanks Yaw,

I tried this out. It seems that (now() - /form/patient/birthdate)
gives me the number of days, but it seems that dividing using "div"
doesn't work. Is there another way around this so I can divide?

Thanks,
Nick

··· On Sep 21, 6:19 am, Yaw Anokwa wrote: > hey nick, > > unfortunately, we don't have great documentation on which xpath > functions ones work, and which ones don't. for what you are > describing, this age estimating xform athttp://pastie.org/2489394 > should help. > > yaw > > > > > > > > On Wed, Sep 21, 2011 at 08:49, Nick wrote: > > Hello, > > > I tried for a long time to find documentation before asking the > > community this, but I simply couldn't get it. > > > I'm trying to figure out what functions I can use in XForms > > calculations. I know I can use "if" and "concat", but I"m interested > > in using "days-from-date" and "seconds-from-datetime" and other > > functions. My forms have so far failed, but this may be because of > > other issues. Basically, all I want to do is have a field > > automatically populate with the age of a person based on their > > birthdate. > > > I'd appreciate any help you can offer, I'm really stuck right now! > > > Best, > > Nick > > > -- > > Post: opendatakit@googlegroups.com > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > Options:http://groups.google.com/group/opendatakit?hl=en

hmm. it should work because the age estimater form does use it
"((now()-/data/BirthDate) div 30.4375)"

··· On Wed, Sep 21, 2011 at 18:32, Nick wrote: > Thanks Yaw, > > I tried this out. It seems that (now() - /form/patient/birthdate) > gives me the number of days, but it seems that dividing using "div" > doesn't work. Is there another way around this so I can divide? > > Thanks, > Nick > > On Sep 21, 6:19 am, Yaw Anokwa wrote: >> hey nick, >> >> unfortunately, we don't have great documentation on which xpath >> functions ones work, and which ones don't. for what you are >> describing, this age estimating xform athttp://pastie.org/2489394 >> should help. >> >> yaw >> >> >> >> >> >> >> >> On Wed, Sep 21, 2011 at 08:49, Nick wrote: >> > Hello, >> >> > I tried for a long time to find documentation before asking the >> > community this, but I simply couldn't get it. >> >> > I'm trying to figure out what functions I can use in XForms >> > calculations. I know I can use "if" and "concat", but I"m interested >> > in using "days-from-date" and "seconds-from-datetime" and other >> > functions. My forms have so far failed, but this may be because of >> > other issues. Basically, all I want to do is have a field >> > automatically populate with the age of a person based on their >> > birthdate. >> >> > I'd appreciate any help you can offer, I'm really stuck right now! >> >> > Best, >> > Nick >> >> > -- >> > 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 >