Hi GIS friends,
This is how I want the structure of my survey to be:
A multiselect question with the five options (maize, soya, rice, groundnuts, other).
Upon selection, a hidden question shows up asking for the the number of acres cultivated for the respective crops.
Afterwards, there is a total acreage question where all the acreages are summed up and displayed as read only.
Now here is the problem: the total acreages value ONLY shows when all of the options in the multiselect question are checked and their corresponding number of acres values are entered. If even one of the multiselect options are left unchecked, the total acreage value does not show. That defeats the purpose of the multiselect question as well as the functionality to only show the relevant corresponding question after a selection is made.
Initially, I thought it was because the algorithm was reading the empty acre value fields as null so I set all of them to be 0 by default. But that didn't work either.
I would appreciate your assistance.
Thank you.
P.S: attached is a copy of my survey xls.
Solved! Go to Solution.
Hi @KayManuel ,
Thanks for the copy of the survey. I think this should sort it for you:
round(((if(string-length(${groundnutcultivated})>0, ${groundnutcultivated}, 0)) + (if(string-length(${maizecultivated})>0, ${maizecultivated}, 0)) + (if(string-length(${ricecultivated})>0, ${ricecultivated}, 0)) + (if(string-length(${soyacultivated})>0, ${soyacultivated}, 0)) +(if(string-length(${othercultivated})>0, ${othercultivated}, 0))),2)
also make sure to set the bind::esri:parameters to calculationMode=always
below is a screenshot of it in action:
Hi @KayManuel ,
Thanks for the copy of the survey. I think this should sort it for you:
round(((if(string-length(${groundnutcultivated})>0, ${groundnutcultivated}, 0)) + (if(string-length(${maizecultivated})>0, ${maizecultivated}, 0)) + (if(string-length(${ricecultivated})>0, ${ricecultivated}, 0)) + (if(string-length(${soyacultivated})>0, ${soyacultivated}, 0)) +(if(string-length(${othercultivated})>0, ${othercultivated}, 0))),2)
also make sure to set the bind::esri:parameters to calculationMode=always
below is a screenshot of it in action:
@j-bromp 's solution is the way to go as there will be no answers if the questions aren't relevant, but an alternative option would be to a make all the acreage questions not visible until the conditions are met instead of not relevant. Then your original total calculation should work.
That makes a lot of sense. It works as well!
Thanks