AnsweredAssumed Answered

Has Anyone Gotten Relationships Working in v100.1?

Question asked by chad.yoder@nwg on Sep 19, 2017
Latest reply on Sep 19, 2017 by chad.yoder@nwg
var relFtrs = await table.QueryRelatedFeaturesAsync (ftr as ArcGISFeature);
foreach (RelatedFeatureQueryResult r in relFtrs) {
     //Get the feature and load the attributes
     ???
    //This is the original feature passed into QueryRelatedFeaturesAsync
     var originalFtr = r.Feature; 
    //This gets set to the expected related table
     var relatedTable = r.RelatedTable;
    //The KeyField property of this is the field name of the original feature key field
     var relInfo = r.RelationshipInfo;
    //These are the fields from the expected related table
     var flds = r.Fields;
}

 

I'd be interested to hear if anyone has gotten this working, as it appears in the cases I have been trying that this code is not working (although I'm also totally confused at the implementation of this).

 

Issues:

- I get a collection of objects returned from QueryRelatedFeaturesAsync, but it is not clear how to get the actual related feature / attributes.

- The originalFtr above is the feature object passed into QueryRelatedFeaturesASync.  Is this by design I wonder?

- The RelatedTable is correct, so I thought I could use the RelationshipInfo to just manually get the related records, but the KeyField property is the original feature field not, not the field name needed for the RelatedTable.  Why not just provide the foreign key field here??

- The Fields are the correct fields, the ones expected from the RelatedTable.

- I could get the RelatedTableId from the RelationshipInfo, but that's the Id in that specific dataset, so if you have mixed data (online and runtime content), then you'll get the wrong layer.  Even if I get the layer, I don't know the key field?!?

 

Any feedback or comments would be greatly appreciated.  Something that should have been a simple task has turned into much more of a production to implement.  Maybe I'm missing something though, I sure hope so....

 

Thanks.

Outcomes