Count select multiple

1860
5
02-04-2020 12:31 PM
Status: Open
MattMulder
New Contributor III

It'd be great if there were a way to create a count of how many times a property was selected from a select_multiple option.

I.e. If you have a grid index .svg and you wanted to create a count of how many times a sighting of an animal occurred within a grid while surveying simply selecting the grid section from the display.

The idea would then be to have a separate field for counting the number of occurrences grid "A1" was selected

The current workflow appears to submitting each time or having it through a repeat. 

5 Comments
Kanin
by Esri Contributor

Could you try using the count-selected(question) function in the calculation column? More details about this functionality can be found here.

FunctionDescriptionExample

count-selected(question)

Returns the number of selected answers. Used for select_multiple questions.

count-selected(${question_one})

MattMulder

Hi Kanin, 

wouldn't this function only count the different selections for the given question. You wouldn't be able count "repetitive" choices of "option 1"?

1 = selected

2 = no

3= selected

count-selected function: count is 2

NathanBruce1

This would be good for a Traffic Count App that my coworker is toying with.

JamesTedrick

Hi Matt,

By your description, it sounds like what you want is already offered through a repeat, as each observation is an independent record.  As part fo the design of the repeat, you can then have a calculate question flag which choice was selected using if(selected({$q},'choice'),1,0) and then use sum(${calc_q}) to total the number of observations

MattMulder

Hi James, 

Thanks for your reply. This was the initial approach we went with, however based on feedback from the field user the added element of essentially "refreshing" the selection page via a repeat became an issue with some quick selections of the same choice.