# Calculation method - divide

Hi there,

Hoping someone can help - working in Excel.
Wondering what value I must put in a field if I want to divide? I would
like to substitute the (+) for a divide in the following equation > *
\${mileage}+\${age}*

Thank you

1 Like

Imobi,

You can use "div" for divide. See the full list of operators here:
http://www.w3schools.com/xpath/xpath_operators.asp (and functions here:
https://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expressions
).

Best,

Chris

ยทยทยท On Monday, November 26, 2012, Imobi wrote:

Hi there,

Hoping someone can help - working in Excel.
Wondering what value I must put in a field if I want to divide? I would
like to substitute the (+) for a divide in the following equation > *
\${mileage}+\${age}*

Thank you

--

Hi Imobi,
For division you would use div. For example: \${mileage} div \${age}
Regards,
-Nathan

ยทยทยท On Monday, November 26, 2012 4:49:03 AM UTC-8, Imobi wrote: > > Hi there, > > Hoping someone can help - working in Excel. > Wondering what value I must put in a field if I want to divide? I would > like to substitute the (+) for a divide in the following equation > * > \${mileage}+\${age}* > > Thank you >
2 Likes

Thanks Chris

ยทยทยท On Mon, Nov 26, 2012 at 2:56 PM, Christopher Robert < Christopher_Robert@hks.harvard.edu> wrote:

Imobi,

You can use "div" for divide. See the full list of operators here:
http://www.w3schools.com/xpath/xpath_operators.asp (and functions here:
https://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expressions
).

Best,

Chris

On Monday, November 26, 2012, Imobi wrote:

Hi there,

Hoping someone can help - working in Excel.
Wondering what value I must put in a field if I want to divide? I would
like to substitute the (+) for a divide in the following equation > *
\${mileage}+\${age}*

Thank you

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

Hi again,

It seems as though the calculation still does not work. Do you know why?
Please find attached my excel form; see J49

Thank you!

inspect_a_car.xls (32.5 KB)

ยทยทยท On Tuesday, November 27, 2012 8:30:05 AM UTC+2, Imobi wrote: > > Thanks Chris > > > On Mon, Nov 26, 2012 at 2:56 PM, Christopher Robert < Christopher_Robert@hks.harvard.edu> wrote: > >> Imobi, >> >> You can use "div" for divide. See the full list of operators here: >> http://www.w3schools.com/xpath/xpath_operators.asp (and functions here: >> https://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expressions >> ). >> >> Best, >> >> Chris >> >> On Monday, November 26, 2012, Imobi wrote: >> >>> Hi there, >>> >>> Hoping someone can help - working in Excel. >>> Wondering what value I must put in a field if I want to divide? I would >>> like to substitute the (+) for a divide in the following equation > * >>> \${mileage}+\${age}* >>> >>> Thank you >>> >>> -- >>> 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 >> > > > > -- > > Larisa Liepins > O. 021 762 1661 > C. 074 284 1688 > >

Division by integers yields an integer result (truncated, not rounded).
From your form it looks like mileage could be a decimal which would then
cause the calculation to yield a decimal result. Does this explain the
problem you are having?

ยทยทยท On Mon, Dec 3, 2012 at 10:58 PM, Imobi wrote:

Hi again,

It seems as though the calculation still does not work. Do you know why?
Please find attached my excel form; see J49

Thank you!

On Tuesday, November 27, 2012 8:30:05 AM UTC+2, Imobi wrote:

Thanks Chris

On Mon, Nov 26, 2012 at 2:56 PM, Christopher Robert < Christopher_Robert@hks.**harvard.edu Christopher_Robert@hks.harvard.edu wrote:

Imobi,

You can use "div" for divide. See the full list of operators here:
http://www.w3schools.**com/xpath/xpath_operators.asphttp://www.w3schools.com/xpath/xpath_operators.asp(and functions here:
https://bitbucket.org/javarosa/javarosa/wiki/xform-
jr-compat#!paths-and-**expressionshttps://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expressions
).

Best,

Chris

On Monday, November 26, 2012, Imobi wrote:

Hi there,

Hoping someone can help - working in Excel.
Wondering what value I must put in a field if I want to divide? I would
like to substitute the (+) for a divide in the following equation > *
\${mileage}+\${age}*

Thank you

--

--

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

Hi,

We are not getting any result at all, a decimal would be ok however

Thanks

ยทยทยท On Tue, Dec 4, 2012 at 9:25 AM, Gaetano Borriello <gaetano@cs.washington.edu wrote:

Division by integers yields an integer result (truncated, not rounded).
From your form it looks like mileage could be a decimal which would then
cause the calculation to yield a decimal result. Does this explain the
problem you are having?

On Mon, Dec 3, 2012 at 10:58 PM, Imobi larisa@imobi.co.za wrote:

Hi again,

It seems as though the calculation still does not work. Do you know why?
Please find attached my excel form; see J49

Thank you!

On Tuesday, November 27, 2012 8:30:05 AM UTC+2, Imobi wrote:

Thanks Chris

On Mon, Nov 26, 2012 at 2:56 PM, Christopher Robert < Christopher_Robert@hks.**harvard.eduChristopher_Robert@hks.harvard.edu wrote:

Imobi,

You can use "div" for divide. See the full list of operators here:
http://www.w3schools.**com/xpath/xpath_operators.asphttp://www.w3schools.com/xpath/xpath_operators.asp(and functions here:
https://bitbucket.org/javarosa/javarosa/wiki/xform-
jr-compat#!paths-and-**expressionshttps://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expressions
).

Best,

Chris

On Monday, November 26, 2012, Imobi wrote:

Hi there,

Hoping someone can help - working in Excel.
Wondering what value I must put in a field if I want to divide? I
would like to substitute the (+) for a divide in the following equation >
\${mileage}+\${age}

Thank you

--

--

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

Sorry I can't check this out quickly but you might try putting spaces
around the operator "div" in your expression.
I've never see it all without spaces as you have it.

ยทยทยท On Mon, Dec 3, 2012 at 11:27 PM, Larisa Liepins wrote:

Hi,

We are not getting any result at all, a decimal would be ok however

Thanks

On Tue, Dec 4, 2012 at 9:25 AM, Gaetano Borriello < gaetano@cs.washington.edu> wrote:

Division by integers yields an integer result (truncated, not rounded).
From your form it looks like mileage could be a decimal which would then
cause the calculation to yield a decimal result. Does this explain the
problem you are having?

On Mon, Dec 3, 2012 at 10:58 PM, Imobi larisa@imobi.co.za wrote:

Hi again,

It seems as though the calculation still does not work. Do you know why?
Please find attached my excel form; see J49

Thank you!

On Tuesday, November 27, 2012 8:30:05 AM UTC+2, Imobi wrote:

Thanks Chris

On Mon, Nov 26, 2012 at 2:56 PM, Christopher Robert < Christopher_Robert@hks.**harvard.eduChristopher_Robert@hks.harvard.edu wrote:

Imobi,

You can use "div" for divide. See the full list of operators here:
http://www.w3schools.**com/xpath/xpath_operators.asphttp://www.w3schools.com/xpath/xpath_operators.asp(and functions here:
https://bitbucket.org/javarosa/javarosa/wiki/xform-
jr-compat#!paths-and-**expressionshttps://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expressions
).

Best,

Chris

On Monday, November 26, 2012, Imobi wrote:

Hi there,

Hoping someone can help - working in Excel.
Wondering what value I must put in a field if I want to divide? I
would like to substitute the (+) for a divide in the following equation >
\${mileage}+\${age}

Thank you

--

--

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

Hi

I just tried adding the spaces in however than I am unable to convert it to
XLS. It gives the following error:
(without the spacing I do not receive an error)

Error: ODK Validate Errors: Invalid XPath expression
[/inspect_a_car/calculation/mileage div\$ {age}]!
java.lang.NullPointerException java.lang.NullPointerException at
org.javarosa.xform.parse.XFormParser.processStandardBindAttributes(XFormParser.java:1501)
at org.javarosa.xform.parse.XFormParser.parseBind(XFormParser.java:1521) at
org.javarosa.xform.parse.XFormParser.parseModel(XFormParser.java:460) at
org.javarosa.xform.parse.XFormParser.access\$200(XFormParser.java:78) at
org.javarosa.xform.parse.XFormParser\$3.handle(XFormParser.java:153) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:375) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseDoc(XFormParser.java:321) at
org.javarosa.xform.parse.XFormParser.parse(XFormParser.java:272) at
org.javarosa.xform.util.XFormUtils.getFormFromInputStream(XFormUtils.java:72)
at org.odk.validate.FormValidator.validate(FormValidator.java:322) at
org.odk.validate.FormValidator.(FormValidator.java:95) at
org.odk.validate.FormValidator.main(FormValidator.java:82) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616) at

ยทยทยท >> Something broke the parser. See above for a hint. Result: Invalid

On Tue, Dec 4, 2012 at 10:03 AM, Gaetano Borriello < gaetano@cs.washington.edu> wrote:

Sorry I can't check this out quickly but you might try putting spaces
around the operator "div" in your expression.
I've never see it all without spaces as you have it.

On Mon, Dec 3, 2012 at 11:27 PM, Larisa Liepins larisa@imobi.co.zawrote:

Hi,

We are not getting any result at all, a decimal would be ok however

Thanks

On Tue, Dec 4, 2012 at 9:25 AM, Gaetano Borriello < gaetano@cs.washington.edu> wrote:

Division by integers yields an integer result (truncated, not rounded).
From your form it looks like mileage could be a decimal which would then
cause the calculation to yield a decimal result. Does this explain the
problem you are having?

On Mon, Dec 3, 2012 at 10:58 PM, Imobi larisa@imobi.co.za wrote:

Hi again,

It seems as though the calculation still does not work. Do you know
why?
Please find attached my excel form; see J49

Thank you!

On Tuesday, November 27, 2012 8:30:05 AM UTC+2, Imobi wrote:

Thanks Chris

On Mon, Nov 26, 2012 at 2:56 PM, Christopher Robert < Christopher_Robert@hks.**harvard.eduChristopher_Robert@hks.harvard.edu wrote:

Imobi,

You can use "div" for divide. See the full list of operators here:
http://www.w3schools.**com/xpath/xpath_operators.asphttp://www.w3schools.com/xpath/xpath_operators.asp(and functions here:
https://bitbucket.org/javarosa/javarosa/wiki/xform-
jr-compat#!paths-and-**expressionshttps://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expressions
).

Best,

Chris

On Monday, November 26, 2012, Imobi wrote:

Hi there,

Hoping someone can help - working in Excel.
Wondering what value I must put in a field if I want to divide? I
would like to substitute the (+) for a divide in the following equation >
\${mileage}+\${age}

Thank you

--

--

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

It should be "\${mileage} div \${age}" (without the quotes).

ยทยทยท On Tue, Dec 4, 2012 at 12:42 AM, Larisa Liepins wrote:

Hi

I just tried adding the spaces in however than I am unable to convert it
to XLS. It gives the following error:
(without the spacing I do not receive an error)

Error: ODK Validate Errors: Invalid XPath expression
[/inspect_a_car/calculation/mileage div\$ {age}]!
java.lang.NullPointerException java.lang.NullPointerException at
org.javarosa.xform.parse.XFormParser.processStandardBindAttributes(XFormParser.java:1501)
at org.javarosa.xform.parse.XFormParser.parseBind(XFormParser.java:1521) at
org.javarosa.xform.parse.XFormParser.parseModel(XFormParser.java:460) at
org.javarosa.xform.parse.XFormParser.access\$200(XFormParser.java:78) at
org.javarosa.xform.parse.XFormParser\$3.handle(XFormParser.java:153) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:375) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseDoc(XFormParser.java:321) at
org.javarosa.xform.parse.XFormParser.parse(XFormParser.java:272) at
org.javarosa.xform.util.XFormUtils.getFormFromInputStream(XFormUtils.java:72)
at org.odk.validate.FormValidator.validate(FormValidator.java:322) at
org.odk.validate.FormValidator.(FormValidator.java:95) at
org.odk.validate.FormValidator.main(FormValidator.java:82) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616) at

Something broke the parser. See above for a hint. Result: Invalid

On Tue, Dec 4, 2012 at 10:03 AM, Gaetano Borriello < gaetano@cs.washington.edu> wrote:

Sorry I can't check this out quickly but you might try putting spaces
around the operator "div" in your expression.
I've never see it all without spaces as you have it.

On Mon, Dec 3, 2012 at 11:27 PM, Larisa Liepins larisa@imobi.co.zawrote:

Hi,

We are not getting any result at all, a decimal would be ok however

Thanks

On Tue, Dec 4, 2012 at 9:25 AM, Gaetano Borriello < gaetano@cs.washington.edu> wrote:

Division by integers yields an integer result (truncated, not rounded).
From your form it looks like mileage could be a decimal which would then
cause the calculation to yield a decimal result. Does this explain the
problem you are having?

On Mon, Dec 3, 2012 at 10:58 PM, Imobi larisa@imobi.co.za wrote:

Hi again,

It seems as though the calculation still does not work. Do you know
why?
Please find attached my excel form; see J49

Thank you!

On Tuesday, November 27, 2012 8:30:05 AM UTC+2, Imobi wrote:

Thanks Chris

On Mon, Nov 26, 2012 at 2:56 PM, Christopher Robert < Christopher_Robert@hks.**harvard.eduChristopher_Robert@hks.harvard.edu wrote:

Imobi,

You can use "div" for divide. See the full list of operators here:
http://www.w3schools.**com/xpath/xpath_operators.asphttp://www.w3schools.com/xpath/xpath_operators.asp(and functions here:
https://bitbucket.org/javarosa/javarosa/wiki/xform-
jr-compat#!paths-and-**expressionshttps://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expressions
).

Best,

Chris

On Monday, November 26, 2012, Imobi wrote:

Hi there,

Hoping someone can help - working in Excel.
Wondering what value I must put in a field if I want to divide? I
would like to substitute the (+) for a divide in the following equation >
\${mileage}+\${age}

Thank you

--

--

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

I added the spaces and displayed the result using a note. I have attached
the form which worked. Try it.

Mito

inspect_a_car.xls (38.5 KB)

ยทยทยท From: opendatakit@googlegroups.com [mailto:opendatakit@googlegroups.com] On Behalf Of Larisa Liepins Sent: 04 December 2012 10:43 AM To: opendatakit@googlegroups.com Subject: Re: [ODK Community] calculation method - divide

Hi

I just tried adding the spaces in however than I am unable to convert it to
XLS. It gives the following error:

(without the spacing I do not receive an error)

Error: ODK Validate Errors: Invalid XPath expression
[/inspect_a_car/calculation/mileage div\$ {age}]!
java.lang.NullPointerException java.lang.NullPointerException at
org.javarosa.xform.parse.XFormParser.processStandardBindAttributes(XFormPars
er.java:1501) at
org.javarosa.xform.parse.XFormParser.parseBind(XFormParser.java:1521) at
org.javarosa.xform.parse.XFormParser.parseModel(XFormParser.java:460) at
org.javarosa.xform.parse.XFormParser.access\$200(XFormParser.java:78) at
org.javarosa.xform.parse.XFormParser\$3.handle(XFormParser.java:153) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:375) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseDoc(XFormParser.java:321) at
org.javarosa.xform.parse.XFormParser.parse(XFormParser.java:272) at
org.javarosa.xform.util.XFormUtils.getFormFromInputStream(XFormUtils.java:72
) at org.odk.validate.FormValidator.validate(FormValidator.java:322) at
org.odk.validate.FormValidator.(FormValidator.java:95) at
org.odk.validate.FormValidator.main(FormValidator.java:82) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57
) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at
a:58) >> Something broke the parser. See above for a hint. Result: Invalid

On Tue, Dec 4, 2012 at 10:03 AM, Gaetano Borriello <gaetano@cs.washington.edu mailto:gaetano@cs.washington.edu > wrote:

Sorry I can't check this out quickly but you might try putting spaces around
the operator "div" in your expression.

I've never see it all without spaces as you have it.

On Mon, Dec 3, 2012 at 11:27 PM, Larisa Liepins <larisa@imobi.co.za mailto:larisa@imobi.co.za > wrote:

Hi,

We are not getting any result at all, a decimal would be ok however

Thanks

On Tue, Dec 4, 2012 at 9:25 AM, Gaetano Borriello <gaetano@cs.washington.edu mailto:gaetano@cs.washington.edu > wrote:

Division by integers yields an integer result (truncated, not rounded).
From your form it looks like mileage could be a decimal which would then
cause the calculation to yield a decimal result. Does this explain the
problem you are having?

On Mon, Dec 3, 2012 at 10:58 PM, Imobi <larisa@imobi.co.za mailto:larisa@imobi.co.za > wrote:

Hi again,

It seems as though the calculation still does not work. Do you know why?
Please find attached my excel form; see J49

Thank you!

On Tuesday, November 27, 2012 8:30:05 AM UTC+2, Imobi wrote:

Thanks Chris

On Mon, Nov 26, 2012 at 2:56 PM, Christopher Robert <Christopher_Robert@hks.harvard.edu mailto:Christopher_Robert@hks.harvard.edu > wrote:

Imobi,

You can use "div" for divide. See the full list of operators here:
http://www.w3schools.com/xpath/xpath_operators.asp (and functions here:
https://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expr
essions).

Best,

Chris

On Monday, November 26, 2012, Imobi wrote:

Hi there,

Hoping someone can help - working in Excel.

Wondering what value I must put in a field if I want to divide? I would like
to substitute the (+) for a divide in the following equation >
\${mileage}+\${age}

Thank you

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

When displaying fields on the same screen (field-list), value changes in
one field are not propagated through calculates or relevant conditions to
any of the other fields on the screen.

So if you are trying to display the calculated field value on the same
screen (field-list), as the values that feed into that formula, this will
not work.

You need to advance to a new screen to have those values propagate through
the formula and the calculated value be correct.

Mitch

ยทยทยท On Tue, Dec 4, 2012 at 1:34 AM, Mofya Phiri wrote:

I added the spaces and displayed the result using a note. I have attached
the form which worked. Try it.****

Mito****

On Behalf Of Larisa Liepins
Sent: 04 December 2012 10:43 AM
Subject: Re: [ODK Community] calculation method - divide
**

Hi****

I just tried adding the spaces in however than I am unable to convert it
to XLS. It gives the following error:****

(without the spacing I do not receive an error)****

Error: ODK Validate Errors: Invalid XPath expression
[/inspect_a_car/calculation/mileage div\$ {age}]!
java.lang.NullPointerException java.lang.NullPointerException at
org.javarosa.xform.parse.XFormParser.processStandardBindAttributes(XFormParser.java:1501)
at org.javarosa.xform.parse.XFormParser.parseBind(XFormParser.java:1521) at
org.javarosa.xform.parse.XFormParser.parseModel(XFormParser.java:460) at
org.javarosa.xform.parse.XFormParser.access\$200(XFormParser.java:78) at
org.javarosa.xform.parse.XFormParser\$3.handle(XFormParser.java:153) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:375) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseDoc(XFormParser.java:321) at
org.javarosa.xform.parse.XFormParser.parse(XFormParser.java:272) at
org.javarosa.xform.util.XFormUtils.getFormFromInputStream(XFormUtils.java:72)
at org.odk.validate.FormValidator.validate(FormValidator.java:322) at
org.odk.validate.FormValidator.(FormValidator.java:95) at
org.odk.validate.FormValidator.main(FormValidator.java:82) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616) at

Something broke the parser. See above for a hint. Result: Invalid****

On Tue, Dec 4, 2012 at 10:03 AM, Gaetano Borriello <
gaetano@cs.washington.edu> wrote:****

Sorry I can't check this out quickly but you might try putting spaces
around the operator "div" in your expression. ****

I've never see it all without spaces as you have it.****

On Mon, Dec 3, 2012 at 11:27 PM, Larisa Liepins larisa@imobi.co.za
wrote:****

Hi,

We are not getting any result at all, a decimal would be ok however****

Thanks****

On Tue, Dec 4, 2012 at 9:25 AM, Gaetano Borriello <
gaetano@cs.washington.edu> wrote:****

Division by integers yields an integer result (truncated, not rounded).
From your form it looks like mileage could be a decimal which would then
cause the calculation to yield a decimal result. Does this explain the
problem you are having?****

On Mon, Dec 3, 2012 at 10:58 PM, Imobi larisa@imobi.co.za wrote:****

Hi again,****

It seems as though the calculation still does not work. Do you know why?
Please find attached my excel form; see J49****

Thank you!

On Tuesday, November 27, 2012 8:30:05 AM UTC+2, Imobi wrote:****

Thanks Chris****

On Mon, Nov 26, 2012 at 2:56 PM, Christopher Robert <
Christopher_Robert@hks.harvard.edu> wrote:****

Imobi,****

You can use "div" for divide. See the full list of operators here:
http://www.w3schools.com/xpath/xpath_operators.asp (and functions here:
https://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expressions
).****

Best,****

Chris

On Monday, November 26, 2012, Imobi wrote:****

Hi there,****

Hoping someone can help - working in Excel.****

Wondering what value I must put in a field if I want to divide? I would
like to substitute the (+) for a divide in the following equation > *
\${mileage}+\${age}*****

Thank you****

-- ****

Larisa Liepins
O. 021 762 1661
C. 074 284 1688****

-- ****

Larisa Liepins
O. 021 762 1661
C. 074 284 1688****

-- ****

Larisa Liepins
O. 021 762 1661
C. 074 284 1688****

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

Thanks so much! got it working

ยทยทยท On Tue, Dec 4, 2012 at 11:34 AM, Mofya Phiri wrote:

I added the spaces and displayed the result using a note. I have attached
the form which worked. Try it.****

Mito****

On Behalf Of Larisa Liepins
Sent: 04 December 2012 10:43 AM
Subject: Re: [ODK Community] calculation method - divide
**

Hi****

I just tried adding the spaces in however than I am unable to convert it
to XLS. It gives the following error:****

(without the spacing I do not receive an error)****

Error: ODK Validate Errors: Invalid XPath expression
[/inspect_a_car/calculation/mileage div\$ {age}]!
java.lang.NullPointerException java.lang.NullPointerException at
org.javarosa.xform.parse.XFormParser.processStandardBindAttributes(XFormParser.java:1501)
at org.javarosa.xform.parse.XFormParser.parseBind(XFormParser.java:1521) at
org.javarosa.xform.parse.XFormParser.parseModel(XFormParser.java:460) at
org.javarosa.xform.parse.XFormParser.access\$200(XFormParser.java:78) at
org.javarosa.xform.parse.XFormParser\$3.handle(XFormParser.java:153) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:375) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseDoc(XFormParser.java:321) at
org.javarosa.xform.parse.XFormParser.parse(XFormParser.java:272) at
org.javarosa.xform.util.XFormUtils.getFormFromInputStream(XFormUtils.java:72)
at org.odk.validate.FormValidator.validate(FormValidator.java:322) at
org.odk.validate.FormValidator.(FormValidator.java:95) at
org.odk.validate.FormValidator.main(FormValidator.java:82) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616) at

Something broke the parser. See above for a hint. Result: Invalid****

On Tue, Dec 4, 2012 at 10:03 AM, Gaetano Borriello <
gaetano@cs.washington.edu> wrote:****

Sorry I can't check this out quickly but you might try putting spaces
around the operator "div" in your expression. ****

I've never see it all without spaces as you have it.****

On Mon, Dec 3, 2012 at 11:27 PM, Larisa Liepins larisa@imobi.co.za
wrote:****

Hi,

We are not getting any result at all, a decimal would be ok however****

Thanks****

On Tue, Dec 4, 2012 at 9:25 AM, Gaetano Borriello <
gaetano@cs.washington.edu> wrote:****

Division by integers yields an integer result (truncated, not rounded).
From your form it looks like mileage could be a decimal which would then
cause the calculation to yield a decimal result. Does this explain the
problem you are having?****

On Mon, Dec 3, 2012 at 10:58 PM, Imobi larisa@imobi.co.za wrote:****

Hi again,****

It seems as though the calculation still does not work. Do you know why?
Please find attached my excel form; see J49****

Thank you!

On Tuesday, November 27, 2012 8:30:05 AM UTC+2, Imobi wrote:****

Thanks Chris****

On Mon, Nov 26, 2012 at 2:56 PM, Christopher Robert <
Christopher_Robert@hks.harvard.edu> wrote:****

Imobi,****

You can use "div" for divide. See the full list of operators here:
http://www.w3schools.com/xpath/xpath_operators.asp (and functions here:
https://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expressions
).****

Best,****

Chris

On Monday, November 26, 2012, Imobi wrote:****

Hi there,****

Hoping someone can help - working in Excel.****

Wondering what value I must put in a field if I want to divide? I would
like to substitute the (+) for a divide in the following equation > *
\${mileage}+\${age}*****

Thank you****

-- ****

Larisa Liepins
O. 021 762 1661
C. 074 284 1688****

-- ****

Larisa Liepins
O. 021 762 1661
C. 074 284 1688****

-- ****

Larisa Liepins
O. 021 762 1661
C. 074 284 1688****

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688

Thank so much for the help!

ยทยทยท On Wed, Dec 5, 2012 at 8:26 PM, Mitch S wrote:

When displaying fields on the same screen (field-list), value changes in
one field are not propagated through calculates or relevant conditions to
any of the other fields on the screen.

So if you are trying to display the calculated field value on the same
screen (field-list), as the values that feed into that formula, this will
not work.

You need to advance to a new screen to have those values propagate through
the formula and the calculated value be correct.

Mitch

On Tue, Dec 4, 2012 at 1:34 AM, Mofya Phiri mofya1@gmail.com wrote:

I added the spaces and displayed the result using a note. I have attached
the form which worked. Try it.****

Mito****

On Behalf Of Larisa Liepins
Sent: 04 December 2012 10:43 AM
Subject: Re: [ODK Community] calculation method - divide
**

Hi****

I just tried adding the spaces in however than I am unable to convert it
to XLS. It gives the following error:****

(without the spacing I do not receive an error)****

Error: ODK Validate Errors: Invalid XPath expression
[/inspect_a_car/calculation/mileage div\$ {age}]!
java.lang.NullPointerException java.lang.NullPointerException at
org.javarosa.xform.parse.XFormParser.processStandardBindAttributes(XFormParser.java:1501)
at org.javarosa.xform.parse.XFormParser.parseBind(XFormParser.java:1521) at
org.javarosa.xform.parse.XFormParser.parseModel(XFormParser.java:460) at
org.javarosa.xform.parse.XFormParser.access\$200(XFormParser.java:78) at
org.javarosa.xform.parse.XFormParser\$3.handle(XFormParser.java:153) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:375) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseElement(XFormParser.java:386) at
org.javarosa.xform.parse.XFormParser.parseDoc(XFormParser.java:321) at
org.javarosa.xform.parse.XFormParser.parse(XFormParser.java:272) at
org.javarosa.xform.util.XFormUtils.getFormFromInputStream(XFormUtils.java:72)
at org.odk.validate.FormValidator.validate(FormValidator.java:322) at
org.odk.validate.FormValidator.(FormValidator.java:95) at
org.odk.validate.FormValidator.main(FormValidator.java:82) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616) at

Something broke the parser. See above for a hint. Result: Invalid****

On Tue, Dec 4, 2012 at 10:03 AM, Gaetano Borriello <
gaetano@cs.washington.edu> wrote:****

Sorry I can't check this out quickly but you might try putting spaces
around the operator "div" in your expression. ****

I've never see it all without spaces as you have it.****

On Mon, Dec 3, 2012 at 11:27 PM, Larisa Liepins larisa@imobi.co.za
wrote:****

Hi,

We are not getting any result at all, a decimal would be ok however****

Thanks****

On Tue, Dec 4, 2012 at 9:25 AM, Gaetano Borriello <
gaetano@cs.washington.edu> wrote:****

Division by integers yields an integer result (truncated, not rounded).
From your form it looks like mileage could be a decimal which would then
cause the calculation to yield a decimal result. Does this explain the
problem you are having?****

On Mon, Dec 3, 2012 at 10:58 PM, Imobi larisa@imobi.co.za wrote:****

Hi again,****

It seems as though the calculation still does not work. Do you know why?
Please find attached my excel form; see J49****

Thank you!

On Tuesday, November 27, 2012 8:30:05 AM UTC+2, Imobi wrote:****

Thanks Chris****

On Mon, Nov 26, 2012 at 2:56 PM, Christopher Robert <
Christopher_Robert@hks.harvard.edu> wrote:****

Imobi,****

You can use "div" for divide. See the full list of operators here:
http://www.w3schools.com/xpath/xpath_operators.asp (and functions here:
https://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat#!paths-and-expressions
).****

Best,****

Chris

On Monday, November 26, 2012, Imobi wrote:****

Hi there,****

Hoping someone can help - working in Excel.****

Wondering what value I must put in a field if I want to divide? I would
like to substitute the (+) for a divide in the following equation > *
\${mileage}+\${age}*****

Thank you****

-- ****

Larisa Liepins
O. 021 762 1661
C. 074 284 1688****

-- ****

Larisa Liepins
O. 021 762 1661
C. 074 284 1688****

-- ****

Larisa Liepins
O. 021 762 1661
C. 074 284 1688****

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

--

Larisa Liepins
O. 021 762 1661
C. 074 284 1688