Select to view content in your preferred language

'Relationship not found in the map' error

1529
11
Jump to solution
10-26-2023 12:59 PM
Paco
by
Occasional Contributor

Hello all!

I am trying to access Related tables in an AGOL Hosted FeatureLayer using JSAPI(4.27) for display in a Popup.

I have tried adjusting the "Browse related records in a popup" code sample,  but am getting 'Relationship not found in the map' error in the popup.

I have added the FeatureLayer and the table as FeatureLayer and have used the "type: relationship" and the "relationshipID" found in the table service,  but still get the error. I have also 'loaded' the table per the sample.

if I use the new AGOL MapViewer 'Relationship' in the popup,  it does see the Related table fields.  any reason why I am not seeing them in my app?  

thx again!

0 Kudos
11 Replies
LaurenBoyd
Esri Contributor

Here is an example application that shows how to display related data information within the selected feature's popup using ExpressionContent: https://codepen.io/laurenb14/pen/xxMOqgr?editors=1000

It's using Arcade's FeatureSetByRelationshipName to get that related data and loop through the related features to print out an attribute in a list. Just select one of the National Park boundaries to see a list of related trails (which participates in a relationship with the NP boundaries layer) that is not added to the map.

Hope this helps!

Lauren
Paco
by
Occasional Contributor

Yes!   Thanks @LaurenBoyd for your efforts on this.   great to have a simplified code version.

I think there should really be a fuller explanation between "relationshipID" and "FeatureSetByRelationshipName" in Related Table popup use.   and I also feel that accessing Related Tables within JSAPI shouldn't be such an involved process?  relating Tables is kindof the heart of GIS information?

Anyways,  thanks again for all your time and help!   now I need to figure out the best way to add multiple Field outputs from the same Related Table..or multiple Related Tables 😉   im hoping some extra HTML will work.   cheers.

0 Kudos