I am using the instructions in the following ESRI post,
The code works for me as I get the information from the intersecting feature. However, I am wondering how can I modify this code so the results do not show any duplicates. For example, I have a large parcel that has patches of Environmentally Sensitive areas. Instead of showing that multiple times, I would like that to appear only once.
Solved! Go to Solution.
One way to avoid duplicate names to use an array to store the names. For each record, the code checks whether the name already exists in the array before adding it. Then it uses the Concatenate function to combine all the items in the array into a comma-separated string.
var feat = FeatureSetByName($map, "Layer1", ["AREA_NAME"]);
var intersectFeat = Intersects(feat, Buffer($feature, 1));
var arr = [];
for (var x in intersectFeat) {
var feat_name = DomainName(x, "AREA_NAME");
if (!Includes(arr, feat_name)) Push(arr, feat_name);
}
return Concatenate(arr, ", ");
One way to avoid duplicate names to use an array to store the names. For each record, the code checks whether the name already exists in the array before adding it. Then it uses the Concatenate function to combine all the items in the array into a comma-separated string.
var feat = FeatureSetByName($map, "Layer1", ["AREA_NAME"]);
var intersectFeat = Intersects(feat, Buffer($feature, 1));
var arr = [];
for (var x in intersectFeat) {
var feat_name = DomainName(x, "AREA_NAME");
if (!Includes(arr, feat_name)) Push(arr, feat_name);
}
return Concatenate(arr, ", ");
Thank You!
I think you want to use a 'group by' statement in your code, I use this statement to summarize the kind of police and fire calls that are recorded for different properties and display those in a popup, the screen shot shows what the popup looks like
var CallsByType = GroupBy(FeatureSetByRelationshipName($feature, "adapt.ADAPT.AdaptLocationCallDetails"),
[
{name:'Department', expression:'BU_SOURCE'},
{name:'Type' , expression:'CALLDESCRIPTION'}
],
[
{name:'Total',expression:'1',statistic:'COUNT'},
{name:'Points',expression:'POINTVALUE',statistic:'SUM'}
]
);
Thank you