Calculation, note and repeat

1. What is the problem? Be very detailed.

I could´nt see the results that I have been chosen in a repeat question.

2. What app or server are you using and on what device and operating system? Include version numbers.

I'm using ODK Collect.

3. What you have you tried to fix the problem?

I posted recently the problem in a form but I could'nt resolve it.

4. What steps can we take to reproduce the problem?

Run the sample XLS form.

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

sumexample_edited.xls (31 KB)

Hi Sebastian,

Form you have uploaded has duplicated names (row 10 and 11).
After erasing one, in calculation you can use directly ${member} because you are in the repeat group. In fact you do not need to use an extra calculate, just directly ${member} .Also relevant in row 11 is redundant because is in repeat group that has the same relevance.
Your form:

Version 1:

Final version:

1 Like

Thank you very much Alexander!

In the same example, my last question is how to show (0) instead (NaN) in the note, when there is no value.

I attached the example.


try changing to:

subtotal = coalesce(${value1},0) + coalesce(${value2},0) + coalesce(${value3},0)

See coalesce() for details. Bascially if the value is null (ie hasn't been answered) it'll return 0. Without 'coalescing', any nulls in an arithmetic expression will cause the whole calculation to become NaN

1 Like

Great man! you are the best! :+1: