Issue with calculate in XLSForms

Hello - I have been unable to use XLSForms to convert the attached form because of an issue in "calculate" when I try to generate a random number for a spot check. I receive the following error:

Error: ODK Validate Errors:
org.javarosa.xform.parse.XFormParseException: Invalid calculate for the bind attached to "${factor}" : Unexpected beginning of path in expression ${entries} /16

It would be wonderful if someone could take a look and let me know what I'm doing wrong. Thank you!

jessica

KE005DataEntryReport_v2.xls (162 KB)

Hi
use ${entries} div 16

Koassi

··· Le mercredi 3 décembre 2014 22:04:58 UTC, jessic...@gmail.com a écrit : > > Hello - I have been unable to use XLSForms to convert the attached form > because of an issue in "calculate" when I try to generate a random number > for a spot check. I receive the following error: > > Error: ODK Validate Errors: > org.javarosa.xform.parse.XFormParseException: Invalid calculate for the > bind attached to "${factor}" : Unexpected beginning of path in expression > ${entries} /16 > > It would be wonderful if someone could take a look and let me know what > I'm doing wrong. Thank you! > > jessica

Correct. The numeric division operator is "div".

This is because XPath expressions are used to reference fields in your
forms; when you type ${foo} the XLSForm converter converts that into an
XPath expression. While the XLSForm expands these with a leading slash,
they could also be expanded using ./ or ../ as a prefix. If the division
operator were allowed to be "/", and spaces were optional (like in most
numeric expressions), then if you wrote this expression:

${numerator}/${denominator}

a valid XLSForm conversion might be: ../numerator/../denominator

which resolves to a valid XPath expression for ../denominator

Because of this confusion, numeric division needed a new operator, "div".

··· -------- Mitch

On Wed, Dec 3, 2014 at 11:53 PM, Koassi AKAKPO akakpo.koassi@gmail.com wrote:

Hi
use ${entries} div 16

Koassi

Le mercredi 3 décembre 2014 22:04:58 UTC, jessic...@gmail.com a écrit :

Hello - I have been unable to use XLSForms to convert the attached form
because of an issue in "calculate" when I try to generate a random number
for a spot check. I receive the following error:

Error: ODK Validate Errors:
org.javarosa.xform.parse.XFormParseException: Invalid calculate for the
bind attached to "${factor}" : Unexpected beginning of path in expression
${entries} /16

It would be wonderful if someone could take a look and let me know what
I'm doing wrong. Thank you!

jessica

--

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.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

1 Like