Select to view content in your preferred language

Related Tables Can't be Added in Pop Up

06-12-2024 08:44 AM
New Contributor

We are currently running into an issue where we can't add in the related table to a pop up in Enterprise 11.1. There is no option to add in a related table under content. 


However, when we add this layer and related table to our ArcGIS Online account, we are able to add in the Related table. 


Has anyone else run into this issue?

0 Kudos
3 Replies
MVP Regular Contributor

This is unfortunately a very well known and quite frustrating issue. Related feature behavior is not yet supported as of Enterprise 11.1. AGOL is always a few software versions ahead of eEnterprise, which is why you can add it there.


If you're interested in visualizing related table data in your popup via Arcade code, I can help you out with that, but there is no native way in Enterprise to view related data until I believe 11.3.

0 Kudos
New Contributor

If there is a way for you to help write an Arcade code, that would be awesome! 

0 Kudos
MVP Regular Contributor

Sure thing! So I apologize if I over explain, I'm not sure how familiar you are with Arcade, but here we go. Here's an example of something I use to visualize related records in a table formatted via HTML 

// Format table html
var tStyle = `<table style="width:100%;background-color:#f4f4f4;">`
var trpt1 = `<tr><td style="border-bottom: 1px solid #cccccc;border-right: 1px solid #cccccc;width:50%;padding-left:2%"><b>`
var trpt2 = `</b></td><td style="border-bottom: 1px solid #cccccc;border-right: 1px solid #cccccc;width:50%;padding-left:2%">`
var trpt3 = `</td></tr>`
var endTable = `</table>`

//set variables. First variable is the unique ID that is shared by the primary and related data. Second variable is calling the related forms as a FeatureSet 
var treeGlobal = $feature.GlobalID;
var relatedForms = FeatureSetByName($map, "Tree Inventory Form")

//create a filter statement where the maintenance form GUID = the Tree Inventory GlobalID
var filterStatement = "TreeInv_Rel = @treeGlobal"

//a maintenance form equals the table run through the filter
var inspForm = Filter(relatedForms, filterStatement)

console (inspForm)

// Sort related features by oldest to newest
var relatedDataSorted = OrderBy(inspForm, 'Date DESC')
var c = count(relatedDataSorted)
console ("Count of relatedDatsorted: "+c)

var returnString
if (c>0) {

  // Set background color by hard-coding a hex value, or swap in a variable
  var backgroundColor = "#7fa99c" 
  // Begin final return string by setting the header and opening the table
  returnString = `<p style="font-size:18px;margin-bottom:8px"><strong>Inspection Records</strong></p>`;
  // Build the pop-up string by iterating through all related features. Add or subtract new lines in the popupString as needed from the related form.

  for (var f in relatedDataSorted){
      returnString += 
          `<h3 style="background-color:${backgroundColor};padding-left:2%">${Text(f.Date, 'MMMM DD, Y')}</h3>
          ${trpt1}Maintenance Performed${trpt2}${DefaultValue(f.Maintenance_Performed, 'No maintenance performed')}${trpt3}
          ${trpt1}Condition${trpt2}${DefaultValue(f.Condition, 'Condition not assessed')}${trpt3}   
          ${trpt1}Chemical Treatment${trpt2}${DefaultValue(f.Chemical_Treatment, 'No chemical treatment')}${trpt3}   
          ${trpt1}Chemical Quantity (ml)${trpt2}${DefaultValue(f.Chemical_Qty_ML, 'No chemical treatment')}${trpt3}
          ${trpt1}Notes${trpt2}${DefaultValue(f.Notes, 'No notes')}${trpt3}
else {
  returnString= `<p style="font-size:18px;margin-bottom:8px"><strong>No Inspection Records</strong></p>`
return { 
	type : 'text', 
	text : `${returnString}`


So the filter variable is how we get our related records. The features used here are a point feature class with related records added in Field Maps, so we're using GlobalID as the parent key and TreeInv_Rel as the child. Then, we essentially cram everything into one variable, returnString, and show that. If there are related records (c>0) then we create an HTML table within a for loop. The for loop uses a variable you identify (in this case, "f") which represents each of the related records. So if you want to see an attribute from the related table, you call it like f.<attribute name> or in this case, ${f.<attribute name>} because we are using template literals. You can easily just return your attributes in a simple line-by-line way, by changing the code to something like:

for (var f in relatedDataSorted){
      returnString += 
         "Date: "+ Text(f.Date, 'MMMM DD, Y')+textformatting.newline
         "Maintenance Performed: "+ f.Maintenance_Performed+textformatting.newline 
         "Condition: "+f.Condition+textformatting.newline


And here's what it looks like:



This particular feature has three related records, so that for loop has run three times and created a table for each

0 Kudos