HOW TO
In real-world datasets, especially in public complaints or feedback systems, related tables often contain valuable unstructured text. Summarizing common keywords from these related records helps identify recurring issues, support decision-making, and uncover spatial patterns without manual review. This article describes the workflow to summarize keywords from related fields in Map Viewer pop-ups in ArcGIS Online or the ArcGIS Enterprise portal using Arcade.
var fs = FeatureSetByRelationshipName($feature, "<nameOfRelationship>", ['<fieldName>'], false);
var related = [];
for (var f in fs) {
Push(related, f);
}
var keywords = ['noise', 'flooding', 'waste', 'traffic', 'crime'];
var summary = ["Complaint Keyword Summary:"];
for (var i in keywords) {
var key = keywords[i];
var count = 0;
for (var j in related) {
var comment = related[j].Comments;
if (!IsEmpty(comment)) {
var txt = Lower(comment);
if (Find(key, txt) >= 0) {
count += 1;
}
}
}
Push(summary, "- " + Proper(key) + ": " + count);
}
return Concatenate(summary, TextFormatting.NewLine);
The code block below shows the example of the full working script:
var fs = FeatureSetByRelationshipName($feature, "Complaints", ['Comments'], false);
var related = [];
for (var f in fs) {
Push(related, f);
}
var keywords = ['noise', 'flooding', 'waste', 'traffic', 'crime'];
var summary = ["Complaint Keyword Summary:"];
for (var i in keywords) {
var key = keywords[i];
var count = 0;
for (var j in related) {
var comment = related[j].Comments;
if (!IsEmpty(comment)) {
var txt = Lower(comment);
if (Find(key, txt) >= 0) {
count += 1;
}
}
}
Push(summary, "- " + Proper(key) + ": " + count);
}
return Concatenate(summary, TextFormatting.NewLine);
The Map Viewer pop-up below displays the summarized keywords from related fields.
Article ID: 000036942
Get help from ArcGIS experts
Download the Esri Support App