HOW TO

Summarize keywords from related fields in ArcGIS Online or the Enterprise portal using Arcade

Last Published: August 11, 2025

Summary

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.

Procedure

  1. Open the web map in Map Viewer.
  2. In the Layers pane, select the layer.
  3. On the Settings (light) toolbar, click Pop-ups. Ensure pop-ups are enabled by toggling Enable pop-ups on.
  4. In the Pop-ups pane, create an Arcade expression to display the field names in the pop-ups. Refer to ArcGIS Online: Use expressions or Portal for ArcGIS: Use expressions for instructions.
  5. In the editor window, configure the expression below:
    1. Load the related feature. Replace <nameOfRelationship> with the name of the relationship between the main feature layer and the related table. Replace <fieldName> with the desired field name to only return the selected field from each related record.
var fs = FeatureSetByRelationshipName($feature, "<nameOfRelationship>", ['<fieldName>'], false);
    1. Cache the related records into an array.
var related = [];
for (var f in fs) {
    Push(related, f);
}
    1. Define the keywords. In this example, the defined keywords are noise, flooding, waste, traffic, and crime.
var keywords = ['noise', 'flooding', 'waste', 'traffic', 'crime'];
    1. Initialize the output list.
var summary = ["Complaint Keyword Summary:"];
    1. Iterate over each keyword, compute the number of related comments that contain it, and append the count to a summary list for output.
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);
}
    1. Combine and return the results.
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);
  1. Click Done.
  2. In the Pop-ups pane, click Fields list and click Select fields.
  3. In the Select fields pane, under Expressions, click the expression created in Step 5 to display in the pop-up and click Done.

The Map Viewer pop-up below displays the summarized keywords from related fields.

The summarized keywords from related fields

Article ID: 000036942

Software:
  • ArcGIS Online
  • Portal for ArcGIS
  • ArcGIS Enterprise

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options