About Relate features

786
2
08-02-2017 01:32 AM
TakahiroKAMIYA
Esri Contributor

Hello,

I could not get the relate table why.

I checked it like a document, but I can not get it why.
Are you doing something wrong?

Relate features—ArcGIS Runtime SDK for .NET (WPF) | ArcGIS for Developers 

private const string ServiceUrl= "http://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0";

// Create feature table for the incident feature service
var relateFeatureTable = new ServiceFeatureTable(new Uri(ServiceUrl));

var relauteFeatureLayer = new FeatureLayer(relateFeatureTable);

:
:
:

// Identify a feature in the 'service request' layer (from a tap on the map, for example)
IdentifyLayerResult idResult = await MyMapView.IdentifyLayerAsync(relauteFeatureLayer, e.Position, 5, false);
ArcGISFeature serviceRequestFeature = idResult.GeoElements.FirstOrDefault() as ArcGISFeature;
if (serviceRequestFeature == null) { return; }

// Get the feature table from the feature
ArcGISFeatureTable serviceRequestTable = serviceRequestFeature.FeatureTable as ArcGISFeatureTable;

// Get a list of tables related to the 'service requests' feature table
IReadOnlyList<ArcGISFeatureTable> relatedTables = serviceRequestTable.GetRelatedTables();

// Assume the comments table is the first (only?) related table
// (if there are many related tables, you can loop through the collection and check the table name)
ArcGISFeatureTable commentsTable = relatedTables.FirstOrDefault();‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor

With your code, you can still get to `LayerInfo.RelationshipInfos` but you cannot get to its related tables or features unless they both participate in the same map. You can explore `GetRelatedTables` when you modify sample here: https://community.esri.com/message/703802-re-retrieve-records-from-related-table-in-arcgis-runtime-s...

0 Kudos
TakahiroKAMIYA
Esri Contributor

Thank you for information.

I could access related tables by adding to the same map.

How do I edit the data for acquired relatedTables?

0 Kudos