Hi all,

I have a form with a `repeat_group`

where I collect some information among which there's the height (cm, integer) and weight (kg, decimal) of my target.

At the end of the repeat, I would like to calculate automatically the average of the group for both the variables, so I added a `calculate`

field using `sum(${field}) div count(${field})`

.

Due to the fact that the `weight`

field is not mandatory, I use `count-non-empty()`

instead of `count()`

but I get the following validation error message from XLSForm online:

Error: b"ODK Validate Errors:\n>> Something broke the parser. See above for a hint.\nError evaluating field 'weight_mean': The problem was located in calculate expression for ${weight_mean}\nXPath evaluation: type mismatch \nconverting to numeric\nCaused by: org.javarosa.xpath.XPathTypeMismatchException: The problem was located in calculate expression for ${weight_mean}\nXPath evaluation: type mismatch \nconverting to numeric\n\t... 11 more\n\nThe following files failed validation:\n${test}.xml\n\nResult: Invalid"

I read around the forum and found this.

I tested a bit trying different approaches, among which using `sum(coaleasce(${field},0))`

but I get another error (i.e. not a nodeset). So this let's me think about a possible bug related to `count-non-empty()`

or something else related to `decimal()`

. Any idea or suggestions?

I'm using version 1.24 .

Attached an example form.

test.xlsx (49.7 KB)

Thanks in advance!