Select to view content in your preferred language

Popups from Intersecting Features

813
4
Jump to solution
09-17-2024 07:20 AM
aam
by
Frequent Contributor

I am using the instructions in the following ESRI post,

https://support.esri.com/en-us/knowledge-base/how-to-display-attributes-of-intersecting-features-in-...

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.

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

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, ", ");

 

 

View solution in original post

4 Replies
KenBuja
MVP Esteemed Contributor

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, ", ");

 

 

aam
by
Frequent Contributor

Thank You!

0 Kudos
clt_cabq
Frequent Contributor

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'}
]
);

clt_cabq_0-1726584422368.png

 

aam
by
Frequent Contributor

Thank you

0 Kudos