Is it yet possible to publish a map service with a related table to AGOL, and view the related table data in a web map popup?
You can use Arcade to grab the attributes easily enough using the FeatureSetByRelationshipName function.
Josh, I tried following that process but still did not display the related table info, but only the field name and object Object.
Well, once you have your FeatureSet, you need to grab individual features and work with them.
for (var feat in featureset) {
// do something here
}
Are you trying to get a single attribute from the related features? If there are multiple related features, how will you choose which to get?
Hi Barry,
I had this issue and hope to provide some insight with my code. The goal was to create a chart which referenced my related table data ("ADT_Data_Merge") with the related road ($feature.MRNLINKID). I created the related table between the ADT Data and MRNLINKID on Pro, but ended up needing to switch to creating a relationship class in order to export my map/relationship to AGOL map. Hope this helps a bit.
// Set variable to MRNLINK IDS
var Road = $feature.MRNLINKID
// Set variable to related table (notice FeatureSetByRelationshipName)
var Table = FeatureSetByRelationshipName($feature, "ADT_Data_Merge", ['Mean_ADT', 'Year'], false)
// filter through table, matching the table's STATIONID with road variable)
var AADT = OrderBy(Filter(Table, 'StationID = @Road'), 'Year')
// this was copied and pasted from AGO community post, I only changed certain variables
var chartValues = {}
var chartNames = []
for (var f in AADT) {
chartValues[Text(f.Year,'0000')] = Text(f.Mean_ADT,'###,###')
Push(chartNames, f.Year)
}
return {
type: 'media',
title : 'AADT by Year',
description : 'Annual average daily traffic by year for this road',
attributes : chartValues, // replace this dictionary with your own key-value pairs,
mediaInfos: [{
type : 'linechart', //linechart | barchart | piechart | columnchart
//title : '',
//caption : '',
altText : 'line chart showing traffic counts by year', //altText will be read by screen readers
value : {
fields: chartNames, // choose what attributes to use in the chart
//normalizeField : '', // the name of the attribute to normalize by or value
}
}]
}
Thank you folks. I have decided to instead create a model that will update values in a feature class from the table instead, as we have the identical fields already in the feature class.
You can have a scheduled notebook run your model as a python script routinely in AGOL or enterprise
See posted solution here also: https://community.esri.com/t5/arcgis-online-questions/display-related-records-in-a-popup-in-a-nice-t...