HI,
I have a strange phenomenon occuring
I have a calculation that used to work, is not being populated anymore.
I have a decimal field with a calculation. The following works:
${TOTAL_TRANSECT_LENGTH}*${DUB_CM_FOURTH}
The calculation is being performed using fields inside a repeat. the calculated field is outside that repeat.
when i substitute the above eqn for this:
pow(pi(),2)*sqrt(sum(${DUB_CM_FOURTH}))div(8*(sum(${TOTAL_TRANSECT_LENGTH})))*1.64
it does not work.
These eqns were working before.
i have attached the xlsform used to generate the survey.
cheers
Hi Lee,
There are a few issues to address on the form; it looks like you made a few changes that change the behavior
- you have four trisect length fields - where these previously a repeat? The formula you have is using sum() over a question that's not in a repeat - it's not going to return the value properly. removing the sum() will allow the calculation to work
- the calculate questions in the repeat that return numbers (DUB, DUB_CM_SQUARED, DUB_CM_FOURTH) should have the bind::type field set to decimal to ensure that calculations are performed correctly.
- at the beginning of the form, there are 2 hidden questions that appear to have been single choice questions previously. Note that hidden questions default to string - you may want to change this to calculate questions with bind::type of decimal as well
Hi James,
Thanks for your assistance.
re:
"- you have four trisect length fields - where these previously a repeat? The formula you have is using sum() over a question that's not in a repeat - it's not going to return the value properly. removing the sum() will allow the calculation to work"
I removed the sum and it worked. Thanks.
It was Sum from a previous version of this survey using repeats- my mistake.
re:
"the calculate questions in the repeat that return numbers (DUB, DUB_CM_SQUARED, DUB_CM_FOURTH) should have the bind::type field set to decimal to ensure that calculations are performed correctly."
Thanks, I changed this at the same time and the calcs work.
re:
"- at the beginning of the form, there are 2 hidden questions that appear to have been single choice questions previously. Note that hidden questions default to string - you may want to change this to calculate questions with bind::type of decimal as well"
Also done. thanks.
PS. meant to say that I'm a bargain basement beginner at this. ive only spent a day or two doing this and so far, pretty good.