What is the pattern for accessing attributes in the .SDK via QueryFeaturesAsync?

437
2
09-13-2019 08:51 AM
RichardHughes2
Occasional Contributor III

Does the QueryFeaturesAsync method on the FeatureTable actually return attribute values?  I am just seeing it return all the information about the layer and the fields, but not the actual attribute values that I need.

I've been unable to find it in the online docs either.  I am simply needing to get the attributes from features in layers that intersect a point.  I've done this a bunch in the other api's but am new to the sdk patterns.  

All my layers are offline in a MobileMapPackage and I am obtaining them from the Map since they are not all visible in the MapView.  An Identify does not work since it only returns the visible features.

What am I missing here?

0 Kudos
2 Replies
RichardHughes2
Occasional Contributor III

So to follow up on this.  

foreach(FeatureQueryResult result in queryResults)
 {
 foreach(Feature feat in result)
 {
 var att = feat.GetAttributeValue("OBJECTID");
 MessageBox.Show(att.ToString());
 }
 }

Just iterating through the FeatureQueryResult gives me access to the Feature which has methods to access the attributes.

0 Kudos
dotMorten_esri
Esri Notable Contributor

Yup that works. You can also use the shorthand feat.Attributes["OBJECTID"]

0 Kudos