Select to view content in your preferred language

Related Tables not connecting to Feature in Portal?

638
3
05-09-2023 03:15 AM
kanhji6
New Contributor

Hello,

I am looking to get more insight into related tables as they pertain to ESRI Portal. Maybe I am attempting to access them incorrectly, but I can access my Feature Layer from a datastore that I sync when updates are made. I am attempting to write a basic popup in a webmap where my "General Plan" feature layer accesses a "URL" field in my "General Plan Table", but when I attempt to write the code I am not seeing the ability to access FeatureSetByRelationship.

Does the datastore not provide the access I need and do I need to publish this layer separately in order to gain the ability to access FeatureSetByRelationship.

Thank you.

3 Replies
Amarz
by
Frequent Contributor

I am attempting the same thing. I was able to get the link to generate in ArcPro, but when I publish it to my Portal, all of a sudden it can not handle the same expression..

0 Kudos
Amarz
by
Frequent Contributor

@kanhji6 

Sorry I had to replace the code as it was not correct.


Anyways, This process is working for me in the following scenarios:

  1.  Publish a Map Image Layer from ArcPro for use in WebApp
  2. Creating a WebMap from a Datastore Feature Service
var gisportal = ('https://xxxxxx.xxxxxxx.gov/portal/');
var relatedrecords = FeatureSetByPortalItem(Portal(gisportal), 
                                            'itemid', 
                                            0, 
                                            ['ZoneCode','URL']);
Console(relatedrecords)


// Filter related features by using a common attribute
var zone = $feature.CC_ZoneCod
var filterStatement = 'ZoneCode = @zone'


// Related features as a variable
var relatedData = Filter(relatedrecords, filterStatement)
Console(relatedData)


// Build the pop-up string by iterating through all related features
var popupString = ''
for (var f in relatedData){
    
    popupString += f.URL
    Console(popupString)
}

DefaultValue(popupString, '')

I am not too knowledgeable in DataStores & how they communicate to related tables in Enterprise / AGOL, but I successfully implemented this to basically do the exact task you mention.

 

0 Kudos
Amarz
by
Frequent Contributor

To add on to my previous response, after reading, Show Tables

It states: 


Tip:

To create a feature layer that contains related records, you must publish the layer from ArcGIS Pro or ArcMap.


 

0 Kudos