Select to view content in your preferred language

Related Record Popups ArcGIS Enterprise Non-Hosted Feature Layers

1248
9
Jump to solution
11-30-2022 06:41 AM
Justin_Greco
Frequent Contributor

I was trying out the new related records popups at 4.25 using non-hosted feature layers on our ArcGIS Enterprise 10.9.1 and I am always getting 0 records for features with related records.  I have tried with a three different feature layers and get the same result.  Does this only work on hosted feature layers?

Here is a Codepen:

https://codepen.io/justingreco/pen/wvXEmop

The property in the middle of the screen should have 71 related condo units.

When looking at the network traffic, I never see the queryRelatedRecords call being made, like I do in the sample.

0 Kudos
1 Solution

Accepted Solutions
LaurenBoyd
Esri Contributor

Currently, only hosted feature layers are supported. Support for non-hosted layers is targeted for Q1 2023. This is noted in the RelationshipContent class API reference page: https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-RelationshipContent... 

Lauren

View solution in original post

9 Replies
JeffreyWilkerson
Frequent Contributor

I think it's working. I just added our bus stop layer and associated routes into your code and it works.

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
    <title>Browse related records in a popup - 4.25</title>
    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
    </style>

    <link rel="stylesheet" href="https://js.arcgis.com/4.25/esri/themes/light/main.css" />
    <script src="https://js.arcgis.com/4.25/"></script>
    <script>
      require([
        "esri/Map",
        "esri/layers/FeatureLayer",
        "esri/views/MapView",
        "esri/widgets/Legend",
        "esri/widgets/Expand",
        "esri/core/reactiveUtils"
      ], (Map, FeatureLayer, MapView, Legend, Expand, reactiveUtils) => {
        // Create the map.
        const map = new Map({
          basemap: "gray-vector"
        });

        // Create the MapView.
        const view = new MapView({
          container: "viewDiv",
          map: map,
          center: {
            x:-112.0732, y: 33.4512
          },
          scale: 1000,
          popup: {
            defaultPopupTemplateEnabled: true,
            // Dock the popup in the top right corner.
            dockEnabled: true,
            dockOptions: {
              breakpoint: false,
              position: "top-right"
            }
          }
        });
        
        const busStops = new FeatureLayer({url: 'https://services2.arcgis.com/2t1927381mhTgWNC/ArcGIS/rest/services/ValleyMetroBusStops/FeatureServer/0', popupTemplate: {
          content: [
{
                type: "relationship", 
                relationshipId: 0,
                description:
                  "Routes associated with this bus stop",
                title: "Bus Stop Routes",
                // Order list of related records by the 'UNIT' field in ascending order.
                orderByFields: {
                  field: "Route",
                  order: "asc"
                }
              }            
          ]
        }});
     
        map.add(busStops);
        const Routes = new FeatureLayer({url: 'https://services2.arcgis.com/2t1927381mhTgWNC/ArcGIS/rest/services/ValleyMetroBusStops/FeatureServer/3'});
            map.tables.add(Routes); 

        
      });
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>

I'm not sure if the problem is hosted vs non-hosted, or something else. The relationship seems  strange in that you have a relationship 0 (condos) for the top layer (property), and then 4 relationships under that (3 to the first relationship (books, addresses, and photos), and 1 back to the top layer (property). Not sure if this matters but just pointing out differences between my layer with a relationship that works in your code. 

You can access the related fields directly using something like this, so I'm thinking it's not an issue with being non-hosted:

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
    <title>Browse related records in a popup - 4.25</title>
    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
    </style>

    <link rel="stylesheet" href="https://js.arcgis.com/4.25/esri/themes/light/main.css" />
    <script src="https://js.arcgis.com/4.25/"></script>
    <script>
      require([
        "esri/Map",
        "esri/layers/FeatureLayer",
        "esri/views/MapView",
        "esri/widgets/Legend",
        "esri/widgets/Expand",
        "esri/core/reactiveUtils"
      ], (Map, FeatureLayer, MapView, Legend, Expand, reactiveUtils) => {
        // Create the map.
        const map = new Map({
          basemap: "gray-vector"
        });

        // Create the MapView.
        const view = new MapView({
          container: "viewDiv",
          map: map,
          center: {
            x:-78.643865, y: 35.779382
          },
          scale: 1000,
          popup: {
            defaultPopupTemplateEnabled: true,
            // Dock the popup in the top right corner.
            dockEnabled: true,
            dockOptions: {
              breakpoint: false,
              position: "top-right"
            }
          }
        });
        
        const property = new FeatureLayer({url: 'https://maps.raleighnc.gov/arcgis/rest/services/Property/Property/FeatureServer/0', popupTemplate: {
          content: [
            {
              type: "fields",
              fieldInfos: [
                { fieldName: "PIN_NUM", label: "PIN"},
                { fieldName: "SITE_ADDRESS", label: "Address"},
                { fieldName: "TOTSTRUCTS", label: "# Structures"},
                { fieldName: "relationships/0/PIN_EXT", label: "PIN Ext"},
                {fieldName: "relationships/0/PIN_NUM", label: "PIN Number"}
              ]
            },
          {
                type: "relationship", 
                relationshipId: 0,
                description:
                  "Condo units associated with this property",
                title: "Condo Units",
                // Order list of related records by the 'UNIT' field in ascending order.
                orderByFields: {
                  field: "PIN_EXT",
                  order: "asc"
                }
              }            
          ]
        }});
     
        map.add(property);
        const condos = new FeatureLayer({url: 'https://maps.raleighnc.gov/arcgis/rest/services/Property/Property/FeatureServer/1'});
            map.tables.add(condos); 

        
      });
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>

 

0 Kudos
Justin_Greco
Frequent Contributor

I just published that single property and its related records to ArcGIS Online (same relationship classes) and I am seeing 71 related records.  Also tried with a hosted feature layer on Enterprise and am seeing the same as I am seeing with the non-hosted layer, 0 records.

Here is a pen with it pointed at an ArcGIS Online service:

https://codepen.io/justingreco/pen/NWzLzLg

 

JeffreyWilkerson
Frequent Contributor

Ah, so the key was adding the popupTemplate info for the related table. I think.

0 Kudos
LaurenBoyd
Esri Contributor

Currently, only hosted feature layers are supported. Support for non-hosted layers is targeted for Q1 2023. This is noted in the RelationshipContent class API reference page: https://developers.arcgis.com/javascript/latest/api-reference/esri-popup-content-RelationshipContent... 

Lauren
Justin_Greco
Frequent Contributor

There it is!  I don't know how I missed that, I know I looked at the section too.  Thank you.

0 Kudos
AshleyPeters
Frequent Contributor

Has support for non-hosted layers been released?

0 Kudos
LaurenBoyd
Esri Contributor

Due to ArcGIS Enterprise limitations, this is still on the roadmap. Support for this is now planned for Q4 2023/Q1 2024.

Lauren
MattEntinger2
New Contributor

Hi Lauren, curious if this has been added to AGOL / Enterprise yet? It would be great to use related records an ArcGIS Online map paired with a feature service. Thank you!

Matt

0 Kudos
Jande_Wit
Esri Contributor

Looks like it is still not supported within the ArcGIS Enterprise 11.3?
  

0 Kudos