Hi everyone,
I’m working with a Survey123 Connect form for a salmon spawning survey. The survey layer has many fields, and depending on what data is collected at a point, many of those fields may not be populated.
Instead of leaving these fields <null>, I’d like them to be filled with "NA" via the survey. All of the fields that should default to "NA" are select_one fields, and all are tied to relevant expressions.
I’ve tried setting this default:
and using this choice filter:
This is for "Flow" data, which is only being gathered when the 'Reach Start' or 'Reach End' Data_Type is selected.
Here is the Relevant expression
${Data_Type} = 'Reach Start' or ${Data_Type} = 'Reach End'
My attempt did not work.
What’s the best approach to populate "NA" for all relevant fields without manually adjusting each one? Any sample formulas, workflows, or best practices would be greatly appreciated!
Thanks,
Aaron
Solved! Go to Solution.
First off, you will need to use the body::esri:visible field instead of the relevant field. If questions are not relevant they are null, i.e. you will not be able to have them hold an answer.
Then, put NA in you choice list for Flow, Weather, and Visibility, And then do a filter on your choice list for those to not show NA when they are visible. The calculation above should work then.
You also many need to make Flow, Weather, and Visibility conditionally required when they are visible.
Hey @WFCAdmin
I found a post here: https://community.esri.com/t5/arcgis-survey123-questions/using-null-or-not-null-values-in-a-field-to...
That outlines this here:
if((string-length(${Location})>0),'existing','new')This basically just says, if a field is present, return existing, else, return NA, in your state, you could extend the if statement to validate that it is a Reach Start or Reach End, and if it is, then it's valid, otherwise, return the NA value. Something like below, note that I had taken notes from the Google Search AI to create this function here:
if(${Data_Type} = 'Reach Start' or ${Data_Type} = 'Reach End', ${Flow_input}, 'NA')
Cody
Thank you for the suggestion, Cody. I tried it and a few variations, but no luck. I took a look at the thread you linked and tried that format with my data, but that did not work either.
I will keep playing around. Appreciate your help!
Aaron
You could just set the Default column to "NA" for all fields, and any entry users make will override that.
Thank you for the reply!
I tried that, and it got me close. I added "NA" to all of the select_one options and set the default to "NA." The problem with this is that I don’t want field staff to have required fields pre-filled with "NA." With the default set to "NA," the select_one was already populated, and I don’t want them accidentally leaving "NA" assigned, resulting in missing data.
Thank you!
Leave the default "NA" off required questions, set their required field to "yes', and maybe add a hint saying something like "This is a required question".
You can also set the Relevant field so a question only appears when a condition is met, usually when another question has or is a particular value, i.e. ${some_other_field} >= 10. Any fields with that condition in their Relevant column that don't match the condition won't show, even when Required is set to yes. The survey can still be submitted.
You can put a formula in the required actually. It will complain but it works. So * != "NA" or similar should work.
But personally having all these NA is not great data practice. Null or blank is NA and call it good. Will end up driving you nuts.
Here is a better example of how the survey is formatted, not – these are all text fields.
Field staff first select the Data_Type via select_one. The options are Reach Start, Reach End, Redd, Live Fish, and Carcass.
If Live Fish is selected, they are prompted with two new select_one questions: Species and Mark. All other fields are hidden, for example, the fields Weather, Flow, and Visibility.
Weather, Flow, and Visibility are also select_one fields that appear if staff first select the Data_Type - Reach Start or Reach End.
If Live Fish is selected, I would like staff to fill in the Species and Mark data, via the select one options. I do not want NA to show up in the select_ one list for Species and Mark. Field staff will not see the Flow, Weather, and Visibility fields, which are assigned NA by a calculation.
If Reach Start is selected, I would like field staff to fill in the Flow, Weather, and Visibility data, via the select one options. I do not want NA to show up in the select_ one list for Flow, Weather, and Visibility. Field staff will not see the Species and Mark fields, which are assigned NA by a calculation.
Flow, Weather, Visibility, Species, and Mark are all required fields and are all select_one
Relevant for Flow, Weather, and Visibility is:
${Data_Type} = 'Reach Start' or ${Data_Type} = 'Reach End'
Relevant for Species and Mark is:
${Data_Type} = 'Carcass' or ${Data_Type} = 'Live Fish'
I have tried the calculation: if(${Data_Type} = 'Live Fish', 'NA', '') for Flow, Weather, and Visibility. When I collected a sample point for Live Fish, Flow, Weather, and Visibility were still <null>, not NA.
First off, you will need to use the body::esri:visible field instead of the relevant field. If questions are not relevant they are null, i.e. you will not be able to have them hold an answer.
Then, put NA in you choice list for Flow, Weather, and Visibility, And then do a filter on your choice list for those to not show NA when they are visible. The calculation above should work then.
You also many need to make Flow, Weather, and Visibility conditionally required when they are visible.