takahiro_kamiyaesrij-esridist

About Relate features

Discussion created by takahiro_kamiyaesrij-esridist Employee on Aug 2, 2017
Latest reply on Aug 4, 2017 by takahiro_kamiyaesrij-esridist

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();

Outcomes