Count Attribute by Another Attribute

315
0
03-09-2022 06:14 AM
ZachBodenner
MVP Regular Contributor

Hello,

I am trying to set up a Survey123 form (using connect) to count the number of "yesses" in an attribute column based on the values of another column. Details:

I am building a public response survey where residents can self-report green infrastructure changes they've made to their property ("I own an EV", "I installed solar panels," etc). The survey will take the form of each of those green infrastructure options as a select_one field, "Yes" or "No." The form will be a table related to a layer of building footprints. The building footprints have a "Neighborhood ID" field which will be used to automatically populate an identical field in the related table. So for example, two houses next to each other will both have the same Neighborhood ID in both of their forms. 

So what I would like to do is set up a field (probably would have to be in the related table itself) that counts the number of "Yes" selections for each green infrastructure column based on that neighborhood ID. Then, in a webhook I will be setting up return emails to the respondents telling them how many other responses in their Neighborhood (by Neighborhood ID) have said "Yes" for each attribute. 

In the above example of two houses next to each other, the first house might fill out the form and say "Yes" to the "I have an EV" question. The webhook would return that one EV is located in their neighborhood. Then, the second house may do the same, and the webhook would return that there are two EVs in their neighborhood. 

My ultimate question then is how do I set up some kind of count function/calculation to populate a field based on all of the entries in the feature layer driving the survey?

0 Replies