Adding a value, such as "Not Relevant" to a conditional questions when condition not met to help with QC

2313
7
Jump to solution
10-21-2017 06:39 AM
Jean-YvesLandry1
Occasional Contributor

I was wondering if it was possible to add a value such as "Not relevant" to a conditional question whenever a condition is not met. 

This would help with Quality control to know which question was skipped, intentionally or not,  and which ones are not relevant.

1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Hi Jean-Yves,

Following on from my previous responses to your question, I have now worked out a way you can apply a "Not Relevant" answer to a following question that you have set as relevant = no. To do this you need to set the esri fieldType to "null" and also use a hidden field for your final answer. Below is an example for pizza questions:

If the user selects "no" to the "Do you like pizza?" question, they will not see the "What toppings do you like?" question (as it is not relevant), however "Not Applicable" response will be populated in the topping field by the calculation. If they answer "yes", the user sees the selections available in topping_null question (note this field does not get saved in schema) and their selection will be populated to the toppings field by the calculation and get stored.

Hope this helps.

Phil.

View solution in original post

7 Replies
by Anonymous User
Not applicable

Hi Jean-Yves,

Based on answers to your questions in the survey you should be able to work out if questions were skipped intentionally, on purpose/by accident, as if the answer to the relevant question is "No" and the relevant statement was set to skip that next question if "No" then you know it is intentional based on relevance. If the answer was "Yes" and the next question is skipped, then you know it was skipped either by accident or the user didn't give an answer on purpose. If you set the next question as required if they select "Yes" it will mean they have to provide an answer and avoid this type of issue.

As for recording a "Not Relevant" response, it would depend on the type of questions you you wan to skip and if you want a value written to the feature service or prefer the question left null and not shown on the survey. If using only text fields this would be possible, either set an additional choice as "Not Relevant" in the choice list, or use a calculation to provide a value of "Not Relevant" in the text field based on previous answers. You can not set a text value of "Not Relevant" against any of the non-text fields such as a numeric (integer, decimal), image, barcode, audio etc as these types of fields will not accept text values.

For non-text fields if you were to set up an additional field for these questions you could use a calculation and set the value to "Not Relevant" based on the answer to previous questions, hiding the actual question (numeric) with a relevant statement and showing the "Not Relevant" as a read only calculation in a text field. Obviously this creates more fields in the feature service and may not be an ideal solution.

Regards,

Phil.

0 Kudos
Jean-YvesLandry1
Occasional Contributor

Thanks Philip,

I understand how to verify skipped or not skipped, however my field coordinators are not always as familiar to the relevance of the questions. Note that we have hundreds of questions in a single form along with multiple repeats with their own 50 odd questions. They thought it would help them if the question would automatically mark skipped or not relevant.

I've tried calculate on strings with mixed results with something like:


question1 = yes
question2 = No,         relevance = string-length(${question1})!= 0       calculate= if(string-length(${question1})= 0, "Not relevant", ${question2} ))

although not sure what to put in the else (${question2}) if I want to keep the entry on that question...
_____________________

Had another idea that would save me the time that it would take to put all those calculate columns.
Throw in a Section check, i.e. if there is a mistake in any question of Section one then the check variable could appear "error".

0 Kudos
by Anonymous User
Not applicable

Hi Jean-Yves,

The problem with your example for question2 is that the relevant and calculate contradict each other. If a question is not relevant in Survey123, it can not have an answer. Your calculate is trying to store an answer in a question that is not relevant, so this will not work. To make your calculate work would mean the question has to be relevant.

Another way you could manage this workflow would be to add a "Not Relevant" entry to each of your choice lists, add a  default value of "Not Relevant" in text fields, use a number equivalent code (ie 9999) for numeric questions, and then instead of using the relevance property in xlsform, all questions would be relevant, and you just set the default value or use calculations/default choices to "Not Relevant", and the user just changes it to the actual real value wanted.

Regards,

Phil.

0 Kudos
by Anonymous User
Not applicable

Hi Jean-Yves,

Following on from my previous responses to your question, I have now worked out a way you can apply a "Not Relevant" answer to a following question that you have set as relevant = no. To do this you need to set the esri fieldType to "null" and also use a hidden field for your final answer. Below is an example for pizza questions:

If the user selects "no" to the "Do you like pizza?" question, they will not see the "What toppings do you like?" question (as it is not relevant), however "Not Applicable" response will be populated in the topping field by the calculation. If they answer "yes", the user sees the selections available in topping_null question (note this field does not get saved in schema) and their selection will be populated to the toppings field by the calculation and get stored.

Hope this helps.

Phil.

JamesChan1
New Contributor II

Hello Phil,

Your 2017 post was super helpful.  I have been looking for this tip for a long time.

Thank you.

OliverSandoval_p
New Contributor III

Hey Phil,

Thank you for your solution! I was about to give up and create a post lol. This helps as I want to be able to have an 'Age' field that is populated no matter what as it can either be calculated using the inputted Birthdate or if the individual does not wish to put birthdate but only their age instead, filled with inputted age. 

I was having trouble figuring out how to have an 'Age' field that calculates age only if birthdate is not empty AND relevant if birthdate is empty at the same time. 

 

Having the user 'Age' field with the esri bind type set to null allows me to set up the calculation that takes either the birthdate(and calculates it into a age in years) or the null age field to a hidden age field that will be stored with the data. 

 

Thanks again!

AnasLunat
New Contributor

i have a similar scenario but with a calculation where "National Insurance" = Yes amount does not display. this hinders the final calculation as it only display where all field equal yes if not no final calculation is done. see imag e attached. tried above solution but did not work.

ESRI_page-0002.jpg

0 Kudos