Assign text values individual scores then calculate mean score

309
2
01-14-2020 12:46 AM
FrankMcCall
New Contributor

I have a 'select multiple' list which users select different text values from. In the next row, I would like each of these risks to be assigned a score, then the average score calculated. 

Giving the 'name' of the text values a number won't work as I am using these numbers elsewhere in the survey. Is there another way to do it? I have had a look at pulldata() function, but not sure how to incorporate this into a calculation. 

Many thanks.

0 Kudos
2 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Frank,

You may be able to do this using the selected(${q},'VALUE') to determine if a choice in a select multiple question is selected; you could use that with an if() statement to add that choice's score to a total (i.e., if(selected(${q},'seatbelts'),70,0) to assign a value of 70 if 'Seat Belts' is selected).

0 Kudos
FrankMcCall
New Contributor

Thank you, that method worked well. 

My calculation looks like this, other that shortening the names, is there any way to make it shorter to achieve the same result?...

(if(selected(${how_harmed_animalscrushing},'Potentialforcollisions'),4,0) + if(selected(${how_harmed_animalscrushing}, 'Minororseriousinjury'),2,0) + if(selected(${how_harmed_animalscrushing}, 'Minororseriousinjuryorevendeath'),5,0) + if(selected(${how_harmed_animalscrushing}, 'Injuryorbrokenbones'),2,0) + if(selected(${how_harmed_animalscrushing}, 'Injurybrokenbonesordeath'),5,0) + if(selected(${how_harmed_animalscrushing}, 'Hitbyfallingobjects'),2,0) + if(selected(${how_harmed_animalscrushing}, 'Potentialtobecrushedresultinginseriousinjuryordeath'),4,0) + if(selected(${how_harmed_animalscrushing}, 'Fallingintowaterresultingindrowningwithpotentialfordeath'),5,0)) div count-selected(${how_harmed_animalscrushing})

0 Kudos