Survey123 Connect tally/count based off of two fields

404
4
11-04-2021 03:09 PM
AndrewSD
New Contributor III

Hello,

I have a survey in Connect for collecting info on fish. I know you can use the sun or count functions but I have not seen the ability to do this:

I have a species name field and a number field. Example, a user selects Salmon and there are 10, Trout and there are 5 and Goldfish 25. This is using a repeat.

Using the notes question I would like to show the fish name and how many there are. If a user just enters Salmon the tally would just show one since it was only entered once. I have not seen a way to sum based on two fields. 

Any ideas?

Thank you,

Andrew

0 Kudos
4 Replies
QuickCaptureAdminAdminAccount
New Contributor II

Hi. I think a custom JS function may do the trick. Check the 'Passing a repeat to pulldata' section in https://community.esri.com/t5/arcgis-survey123-blog/extending-survey123-smart-forms-with-custom-js/b...  

0 Kudos
AndrewSD
New Contributor III

Thank you for the link! I am not that great at JS functions but I will try that out. It looks like in the example that you would have to write out each fruit that you would want to get info on. In my survey I have around 60 fish choices so that might take a while to write. I was hoping to find something that could list all the values entered in the fish field and the corresponding quantity of each.

Thank you!

0 Kudos
BarbaraWebster1
Esri Contributor

Hi Andrew,

You could create a fish count field for each type of fish and then make them relevant based on the species name field. 

You could also make the final count note questions relevant based on whether the sum of each fish count question is greater than 0.

See attached XLSForm for an example. Is that close to what you were looking for?

-Barbara





0 Kudos
AndrewSD
New Contributor III

Hi Barbara,

Thank you for your reply. Unfortunately, there are around  60 fish choices so that might get a little chaotic. I was hoping to find a JS function to do this but I will keep this method in mind if I can't.

Thank you!

0 Kudos