I'm running into a problem between the relevant and calculation columns:
I have several groups that are relevant to a 'select_one' ${NAME}. IE, the user selects the ${NAME} of the group, and that group of questions is the only one to appear for user input.
In the relevant column for each group, I've been using
${NAME} = 'x'
where x is one of the groups, and it's been successful in getting only the selected group to appear.
Part 2 is that I've also been using if statements in the calculation column in order to specify default answers only when the ${NAME} of that group is chosen. However, the if statements are filling in default answers regardless of which group is chosen, UNLESS that group is selected (and the group's questions open) at some point. Basically, if I open it, no more default answers for that group unless that's the group I end up submitting.
Here are the if statements in the calculation column that I'm trying to work with:
if(${NAME} = 'x','y','') where y is the preferred default option.
I've also tried:
if(selected(${NAME},'x'),'y',''))
with no success.
I also have esri::bind:parameters set to: calculationMode=always to try and force it to recalculate all the time, but with or without that, the calculation inputs default answers unless the group is displayed.
Finally, if I change the formula in the relevant column so that my groups are all visible when the survey is opened, and then hide the not-selected groups when one is selected, the calculation works just fine to fill in only the default answers for the selected group. To accomplish this I used (eg, for group 'f'):
not(selected(${NAME},'a')) and not(selected(${NAME},'b')) and not(selected(${NAME},'c')) and not(selected(${NAME},'d')) and not(selected(${NAME},'e'))
but this doesn't seem like the best way to do it.
Although it works the main downside is that the survey looks unkempt when all groups are visible. What I'm aiming for is to have all groups hidden until their ${NAME} is chosen, but also not have defaults calculated unless the relevant group is selected. I'm guessing this is just how calculations are done for hidden groups, but if anyone has a suggestion, I'd appreciate any help. Thanks in advance!
Little hard to follow but first try this. For the relevant column you want a true statement not the word yes in an if.
Use just ${NAME} = '1' but really if you are hiding that section with a relevant then just regular required should work. If the group is hidden relevant do not fire anyway.
You also have one required if('0') which I do not understand its just a 0 in an if?
Same with your calculations. Why not just set the values? I do not think you need an if statement at all. If the group is not relevant they all are blank anyway. You seem to be doing what relevant does twice. Instead of if(${NAME} = 'x','y','') just do 'y'. You can also try this in the default but sometimes it does not work coming back from a relevant.
Hope that makes sense and it helps.