Select to view content in your preferred language

Simple Arcade Question

597
2
07-13-2023 02:46 PM
YS2388
by
Regular Contributor

Hi there,

I am new to Arcade programming and I have a simple question:

This is a standard scenario: I have created a feature point layer and a related table for use in Field Maps. This is a one-to-many relationship. Someone has gone out and collected multiple records for each point. 

In Map Viewer, I would like the pop-up for the point layer to display the number of records for that point. 

In the point layer's pop-up configuration I enter the following expression:

 
var relRecord = FeatureSetByRelationshipName($feature, "Rel_table");
var cnt = Count(relRecord);
return cnt;

When I click on any point the total number of records is always 1, even though there are always more than one.

Thank you for the help.

0 Kudos
2 Replies
JohannesLindner
MVP Frequent Contributor

Hmm, does it work if you filter the related table yourself?

var rel_fs = FeaturesetByPortalItem(...)
var common_val = $feature.CommonField
var rel_rows = Filter(rel_fs, "CommonField = @common_Val")
return Count(rel_rows)

Have a great day!
Johannes
0 Kudos
YS2388
by
Regular Contributor

Hi Johannes,

Thanks for the suggestion. I tried filtering and still have only the first record returned.

0 Kudos