AnsweredAssumed Answered

Update related table

Question asked by JerrySimmons on Nov 14, 2017
Latest reply on Nov 14, 2017 by JerrySimmons

I'm trying to build an application to edit related table records and I'm building off of the code in this discussion, however, it "seems" I should be able to loop through the related features and update the "Comments" field to a value of "Test".  When I run the following code it continues the loop and doesn't kick out once all results have cycled through.  Not sure if I've got something wrong or there is something else going on.

 

If I comment out the await line in the loop, the process kicks out of the loop as expected....

 

var queryResults = await table.QueryRelatedFeaturesAsync(feature);
foreach (var queryResult in queryResults.ToArray())
{

foreach (var f in queryResult)
{
var sft = (GeodatabaseFeatureTable)f.FeatureTable;
var id = (long)f.Attributes[sft.ObjectIdField];

f.Attributes["Comments"] = "Test";
await f.FeatureTable.UpdateFeatureAsync(f);
}

 

}

Outcomes