Good morning all. I know nothing about Arcade, and what I thought would be a straight forward code, has not turned out that way. I have an AGOL map that I created a web map from. It consists of a feature service of houses of worship. There is a field in the att table called Affiliation. All I want to do in the legend is show :
Affiliation Name / number of affiliations
where the "Affiliation Name" is an entry in the Affiliation field of the att table, and "number of affiliations" is the total count number of each different affiliation. What I am striving for is:
Buddhist / 2
Catholic / 7
Etc.
My Arcade code is:
($feature.Affiliation) + " " + TextFormatting.ForwardSlash + " " + Count($feature.Affiliation)
When I click TEST, it looks exactly what I want:

Being overjoyed I figured something out, I gleefully clicked OK, only to have my Arcade scripting skills dashed when I got the disheartening message of:
Warning
The expression must return a number value.
I have been on Google, AGOL help, & Arcade Help, and unfortunately I cannot find anything relating to me. Any help would be appreciated.
And one more question about AGOL web map/app: Does what appears in the popup always appear in the legend and vice versa?
Thanks, Catherine