Required, Default, Relevant and Calculation Relationships

111
3
12-13-2018 11:18 AM
Highlighted
New Contributor III

Hello,

I am having trouble with understanding how the Required, Default, Relevant and Calculate work relate to one another in Survey123.  I understand the if a default is applied this default will populate the feature service if the question is relevant or not.  I would like to know how the rest relates so I know how to write calculations, relevant statements, requirement statements and use defaults to accomplish the desired outcome in the feature service.  Is there ever a situation where the calculation will take place when it is not relevant?  What is the overall hierarchy/sequence of events/rules when these fields are populated in any combination.  Is there any relationship to these and the type of question?

Katie.

Reply
0 Kudos
3 Replies
Highlighted
New Contributor III

Sorry I did not include this in my first post but, here is an example.  My assumption was that the calculation would happen regardless of the relevant statement, so I has started with a simple calculation statement.  I learned it did not and beefed up my calculation statement to account for the relevant statements.  That still did not work.  I have attached an example.  I tried to do the default to be -99 but then I got a result of -99 for those questions that required a 0.  Any ideas of a solution?

Katie.

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Katherine,

If a question is not relevant, a calculation will not be triggered.  

The formula you provided will not trigger a 0 value, as the R_Sample event will set a value of -99 before it gets to the end (which looks for R_Sample and Trash_Present_IND = N).

To make your calculation a little easier to understand, I would suggest grouping the conditions that lead to the same result with 'or' clauses in one level of the if() function i.e., if(selected(${q}, 'condition1') or selected(${q}, 'condition2'), -99, 0)

Reply
0 Kudos
Highlighted
New Contributor III

I would say that I agree with the exception of calculate question types.  I have found that those will trigger a calculation when in a group that is not relevant.  I have used this functionality to accomplish what I would like.  The downside to this is that one must create many domains in the feature service that would have been created if there was other functionality to allow for calculations while "not relevant".  There is also more time and effort in creating and maintaining the survey excel which is now rather long.  With that there is a way to accomplish what I want to be done, and for that I am grateful.  I have been able to reduce post processing of my data a significant amount, so the trade off in time spent creating will end up paying off.

Thank you for the suggestion for improvement.

Katie.

Reply
0 Kudos