Create a customised pop-up that shows the information from a related table.

419
4
Jump to solution
03-09-2020 11:28 AM
JeffVan_Etten1
New Contributor III

I am trying to create a customised pop-up in AGOL for a web layer I have uploaded that has a related table (text only).  

Polygon table structure is:

GlobalID (GUID)

Area (shape_area)

Length (shape_length)

Related table structure

GID1 (GUID) - this is the related key back to the parent polygon table

Type (text)

Number (short)

Phase (text)

Right now I can click on "show related records" in the pop-up, but ideally I would like this information to be displayed in the pop-up and not in a separate table below the map.

I tried doing some simple arcade programming and got the expression result to work using this:

FeatureSetByRelationshipName($feature,"native_plantin_rel_table",["Type","Number","Phase"])

But when I implement this in the popup, it does not work and only get "No information available" message in the popup

Any ideas?

Thanks in advance!

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Hi Jeff Van Etten ,

When you use an expression like you did, this will return a featureset, which will show when you test the expression in the editor, but this will not show in the pop-up. You will have to loop through the records in the featureset and define how to present them in the pop-up.

You can find some examples here: https://community.esri.com/message/900835-show-all-related-or-joined-attributes-in-a-popup 

View solution in original post

4 Replies
RobertBorchert
Frequent Contributor III

Most commonly the Web Maps you create are for use in Collector to get what you want.

You will need to make a Web App using Web App Builder and related tables will show up in a pop up.

0 Kudos
JeffVan_Etten1
New Contributor III

Robert, this is not for collector.  Thanks.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Jeff Van Etten ,

When you use an expression like you did, this will return a featureset, which will show when you test the expression in the editor, but this will not show in the pop-up. You will have to loop through the records in the featureset and define how to present them in the pop-up.

You can find some examples here: https://community.esri.com/message/900835-show-all-related-or-joined-attributes-in-a-popup 

JeffVan_Etten1
New Contributor III

Xander

Have looked at the link and I can test the arcade script and it works, but when I try to use this, nothing is coming up.  Here is my arcade script.

var aquatic_id = $feature["GlobalID"];
var aquatic_tbl = FeatureSetByName($map,"aquatic table");
var sql = "GID1 = '" + aquatic_id + "'";
var aquatics = Filter(aquatic_tbl, sql);
var cnt = Count(aquatics);

var result = "Species: ";
if (cnt > 0) {
for (var aquatic in aquatics) {
result += TextFormatting.NewLine + " - " + aquatic.Type + " (" + aquatic.Number + ")";
}
} else {
result += TextFormatting.NewLine + " - No species present";
}

return result;

Just closed the map viewer and opened this back up and it now works!  Fantastic!

0 Kudos