Select to view content in your preferred language

Color coded answers from same list

246
6
09-09-2024 10:13 AM
ScottJones1
Regular Contributor

I have an extensive list, over 100 possible selections. However they are 3 distinct groups, Runs, Run Outs, Routes. So that they show up in a Dashboard under the same column in a Table, I have grouped them all together. I would like to see them with some individuality though, is there a way to create a calculation? that when an answer is from c4:c40 it displays blue, C41:C61 it displays red.....

0 Kudos
6 Replies
clt_cabq
Frequent Contributor

are you talking about displaying these color coded items in a list in the dashboard? You can use arcade in the advanced formatting section of the list configuration to do this probably. Here's some arcade I have that colors inspections by the number of days since a location was visited - red for over 100, orange for 60-100 days, and green for under 60 days, and a screen shot of what the list looks like. I don't know if tables offer the same kind of formatting though since I haven't worked with them.

// calculates the number of days since a location has been inspected, if greater than 100 days then the background turns Red
var daysSince = round(DateDiff(Today(), $datapoint.LastInsp,'days'))
// var alert = 100
var bkgrnd = When(
  daysSince > 100,'#FF7f7f',
  daysSince >= 60 && daysSince <=100,'#ffb461',
  '#8efc8d')
//var nextVis = $datapoint.nextVisit
var vistTxt = IIF($datapoint.nextVisit > 0,'Next visit is scheduled for' ,'No additonal visits have been secheduled at this time.')
var visDays = round(DateDiff($datapoint.nextVisit, Today(),'days'))
var daysTxt = IIF(visDays > 0, 'in ' + visDays + ' days','')
return {
  textColor: '',
  backgroundColor: bkgrnd,
  separatorColor:'',
  selectionColor: '',
  selectionTextColor: '',
    attributes: {
      numDays: daysSince,
      schedVis: vistTxt,
      schedDays: daysTxt,
    }
}

 

clt_cabq_0-1725905183590.png

 

0 Kudos
ScottJones1
Regular Contributor

I was hoping to be able to have the Survey123 automatically change the color based on the answer, was hoping I could input a command that would take the fields ie, c2:c26... it would be way to tedious to list every answer. I could do a list and have specific fields have a color, but my dilemma goes back to the Survey, I am trying to only have one field to capture all the responses... my experience has been the more fields you offer the more confusion on the inputters. I think what i might end up having to do is add a (T)=Trail, (R)=Route, (P)=Path to the end of each name, so that it shows up on the answer   Red (T), Blue (T), Wing (R), Bird (R).... It is more for quick reference to identify what the patroller is doing, if they list a (P) answer, they were most likely doing some sort of preventative avalanche mitigation and the Lead would want to pay more attention to that then a (T) answer which is just general work.... Its just that color helps the answer to stand out... I am trying to avoid having three different dashboards and being able to look at one and see all activity.. In the pic , below the SS Run Out would be changed to Run - Path - Route, and the responses would be color coded...

ss records.png 

0 Kudos
JenniferAcunto
Esri Regular Contributor

I personally would add a field to my survey for your three categories (Runs, Run Outs, Routes). If it makes sense to the user I would display that question to them and use that answer as a choice filter to filter the choices presented.

If it doesn't make sense to display that category to the user, then I would probably set up the choices to pull from an external choice list that includes what category it belongs to and use a pulldata calculation to pull in that category value into a hidden field.

Either way, I would use that category value in the Dashboard Advanced Formatting to control the color. That way you only need to account for 3 category values as opposed to your hundreds of choice options. An added bonus is that category field can also be used as a filter in your dashboard if users want to drill down to a specific category type. 

You do not want the survey to hardcode colors for you. Updating those colors will be a bigger pain, you have to change and republish the survey, then go and clean up existing data. Having the dashboard calculate the color based on a category field means updating the color is super quick and easy. 

Dynamic Choice Filters

External Choice Lists

Pulldata

Dashboards That Pop: Arcade

- Jen
0 Kudos
ScottJones1
Regular Contributor

Thanks Jennifer, I will admit I have not had a chance to review the reference links... but if I am understanding (and I have a small brain so bare with me), is there a way to have multiple categories, that populate a single field? I have worked with categories in Survey123 Connect, but that was to open specific groups. I would be very ok if I could have the 'patroller' Enter Date/Time; Name: and then select a work run entry type; Trail : Run Out : Route, that would then limit the answers to one field Work Run

Such that Trail Field only allows Apples, Oranges, Bananas... and the Run Out only allows Cars, Vans, Trucks.... but they are all housed in the Work Run field... I think I could figure out how to color code in Dashboard...

0 Kudos
clt_cabq
Frequent Contributor

You'll want to explore using the choice lists capabilities of survey123 - the first link that was posted will help explain how it works. This allows you to specify which options populate in your question based on how you responded in a previous question - you end up having to add a field to your xlsx that tells s123 which options are valid given a certain response elsewhere. Its pretty slick really. In the screen shots you can see that the options available in the 'Determination' field depend on the type of Inspection that is selected.

clt_cabq_0-1726157496433.png

clt_cabq_1-1726157546954.png

 

 

JenniferAcunto
Esri Regular Contributor

Yes, that is how the Choice Filters operate. You can find a choice filters sample survey (and many others) in the samples option of Connect. This is a great resource for seeing how some of the more advanced capabilities are used in real surveys. 

JenniferAcunto_0-1726161656046.png

 

- Jen
0 Kudos