Data Consistency with wide range of values in Survey123 and Dashboard

1370
6
Jump to solution
03-30-2021 07:07 AM
JoshBillings
Occasional Contributor

Hey all,

I have a survey that feeds into a Dashboard for Events that are occurring in our Recreation and Parks department. On the dashboard, one of the selectors is "Age Group." Within the survey, the "Age Group" is formatted as a text question. Staff enter age group as "7-12" etc. I instruct staff in the survey to only use numbers but staff still type more than necessary sometimes.

I am trying to get staff to not enter any text (such as "years" or "years old" as seen in the picture attached) but can't use predefined answers due to the age groups being so different for each type of event. At the same time, "All Ages" must still be an option to enter.

Do you all have any suggestions on how I can maintain data consistency in Survey123 when staff enter in the Age Group while still being able to use Age Group as a category selector in the dashboard? 

1 Solution

Accepted Solutions
Jim-Moore
Esri Regular Contributor

Hi @JoshBillings in addition to Doug's suggestions, one other option could be to have two integer questions where staff can enter min & max ages, then have a hidden text question that concatenates these into an age range string, e.g. "7 - 12". You could precede this with a select_one that has two choices, e.g. "All ages" or "Specific age range", with the min/max integer questions relevant based on the selection. You could then use an if() statement in the hidden text question to set the string to "All ages" or the concatenated age range.

Best, Jim

View solution in original post

6 Replies
DougBrowning
MVP Notable Contributor

Take a look at input masks

https://doc.arcgis.com/en/survey123/desktop/create-surveys/esricustomcolumns.htm

Also a list would work if you have set groups.

Hope that helps

Jim-Moore
Esri Regular Contributor

Hi @JoshBillings in addition to Doug's suggestions, one other option could be to have two integer questions where staff can enter min & max ages, then have a hidden text question that concatenates these into an age range string, e.g. "7 - 12". You could precede this with a select_one that has two choices, e.g. "All ages" or "Specific age range", with the min/max integer questions relevant based on the selection. You could then use an if() statement in the hidden text question to set the string to "All ages" or the concatenated age range.

Best, Jim

JoshBillings
Occasional Contributor

Yes @Jim-Moore , this would work great!

I am running into an issue when I publish it though. 

In Survey123 Connect, everything seems to work fine.

JoshuaBillings_0-1617208050287.png

However, when I publish this, the Minimum and Maximum Age selections don't show up when Specific Range is selected. Any idea why this could be?

JoshuaBillings_1-1617208124055.png

 

 

 

0 Kudos
Jim-Moore
Esri Regular Contributor

Hi @JoshBillings thanks for the screenshots. Not sure what's causing the NaN error in the web app without seeing your XLSForm, but please see example survey attached demonstrating one way to set up the questions. The calculation for age group uses the if() and concat() functions to return the formatted age range.

If you don't want to store the min/max age fields in the feature layer you could set bind::esri:fieldType to null for these questions.

Hope this helps! Best, Jim

JoshBillings
Occasional Contributor

Thanks @Jim-Moore! My error was in the "relevant" field. This works!

One final thing. I would like my Age Groups to be able to sort based on number value. Because I have text in my Age Groups (ie. 18 and over, All Ages), the field is a text field and is sorting it like text. Any work around for this?

JoshuaBillings_0-1617627024620.png

 

0 Kudos
Jim-Moore
Esri Regular Contributor

Hi @JoshBillings one way to overcome this would be to pad the single-digit minimum ages with a zero, so for example 5-18 would be stored as "05-18". You could build this into the calculation using a nested if() statement to add a leading zero if the minimum age is greater than zero and less than 10, for example:

if(${age_group}='all_ages', 'All ages', if(${min_age} > 0 and ${min_age} < 10, concat(0, ${min_age},' - ',${max_age}), concat(${min_age},' - ',${max_age})))

This should sort the values correctly in your dashboard; if you want to remove the leading zeroes it looks like you could then use the Load Categories setting for the category selector to modify the labels for each age group individually.

Best, Jim

0 Kudos