Calculate on Relevent names

1. What is the problem? Be very detailed.
Used Select multiple and relevant - selected format
2. What app or server are you using and on what device and operating system? Include version numbers.
ODK Collect, Android
3. What you have you tried to fix the problem?
Need to perform sum operation on data collected from Select multiple group with relevant selected
4. What steps can we take to reproduce the problem?

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

Welcome to the ODK forum, @I.NANDHA_KUMAR ! We're glad you're here. When you get a chance, please introduce yourself on this forum thread. I'd also encourage you to add a real picture as your avatar because it helps build community!

Are you able to post an example form of what you've tried so far?

FORM3.xls (46 KB)
in survey page Row no. 71 not working in odk collect
calculate TDT Total downtime ${SC}+${QC}+${IC}+${OC}+${LOI}+${DM}+${PM}+${EM}+${MM}+${BD}+${PF}+${MHES}+${SS}+${OSOW}+${LI}+${WBS}+${PSWB}+${SWB}+${JBWBPF}+${JBWB}+${IPTC}+${IWB}+${IPTWB}+${WDC}+${AC}+${WS}+${DGEB}

If there is a selected downtime cause in line 31. And then you don't provide a number for it when asked later. It will fail to calculate and the "Downtime Details" will show "Total downtime of the shift : NaN"
The calculation appears to be working otherwise. You could try and make them required to force an input.

Couldnt get u
Pls explain in detail

i have used Relevant option with selected input
so user should select which cause to select and respective cause an integer will be entered
my Total downtime should add all the selected causes input values

It seems to be working. I can select the causes...

And then it asks me the amount of time for each selected cause...

And then it shows the totals sum of the times...


If I don't provide a number answer for one the questions. For example, if I leave it blank...

Then, the total fails to calculate...

because of that only i set default value as 0 for all causes

then why that default 0 not working

Even with default set, it is possible for the user to submit a blank answer, if they delete the 0. I think you want to also set required to yes for all the rows.

All the causes default value set to 0
User will select only the required causes he want to enter
so he will enter values for all selected causes
so if we perform add operation it should display the result know????

When I test it, the total is calculated. Please upload a demo data export showing how it is failing.

I think Dan's suggestion of making each field required is a good idea to ensure that no fields are left blank accidentally, but in cases where it might be possible for a value to be skipped, you can replace the value with the expression if(${field} = null, 0, ${field}) so that a calculation doesn't fail when a field is not relevant.

So, if this is your expression:


You could replace each item in the list, like so:

if(${SC} = null, 0, ${SC}) + if(${QC} = null, 0, ${QC}) + if(${IC} = null, 0, ${IC}) + etc.

The reason this helps is that if you have an expression like ${A} + ${B} + ${C}, if A or B or C is ever null (has no value), the entire expression will fail. Since each of these items is only relevant when selected in an earlier field, if any of them is not selected the "TDT" field will be blank, even if you have defaults set to 0.

But making all of the field required is a good idea as well, whether or not they are all relevant in all cases.