I am trying to Query a Feature Layer, but only the core ESRI attributes are being returned. How do i get all of the attributes? If i look at the Fields property of the feature layer (_featureLayer below) i am querying, it does list all the custom fields available, but they just aren't returning when i do a query. There isn't a "OutFields" property in the QueryParameters object that I can see...
Query code below.
var query = new QueryParameters
{
Geometry = TreeMapView.VisibleArea,
SpatialRelationship = SpatialRelationship.Contains,
ReturnGeometry = true,
};
_featureLayer.ClearSelection();
var queryResult = await _featureTable.QueryFeaturesAsync(query);
var features = queryResult.ToList();
foreach (var item in features)
{
//*** EACH item has only 7 attributes, and they are only the ESRI core ones
}
Solved! Go to Solution.
By custom attributes, do you mean the service does not define these fields?
Are you working with ServiceFeatureTable? If yes, there is a LoadAll that will return all fields defined by service, the other QueryFeatures method will return minimum set of attributes (i.e. objectIdField, typeIdField, fields used for rendering, etc.) https://developers.arcgis.com/net/latest/wpf/api-reference//html/T_Esri_ArcGISRuntime_Data_QueryFeat...
By custom attributes, do you mean the service does not define these fields?
Are you working with ServiceFeatureTable? If yes, there is a LoadAll that will return all fields defined by service, the other QueryFeatures method will return minimum set of attributes (i.e. objectIdField, typeIdField, fields used for rendering, etc.) https://developers.arcgis.com/net/latest/wpf/api-reference//html/T_Esri_ArcGISRuntime_Data_QueryFeat...
Aye, that's it thanks.
Yes, working with a ServiceFeatureTable. All 50 attributes now returning. Not sure how i missed that overload.
Cheers!
var queryResult = await _featureTable.QueryFeaturesAsync(query,QueryFeatureFields.LoadAll);
It would be helpful to include this option in the samples, as I think most people would expect LoadAll to be the default.
Hello,
Is there any similar method if I am working with FeatureLayer from mmpk?
Thanks
You should get all the properties directly since you are working with GeodatabaseFeatureTable. You can make sure that the features you use are loaded though.
While the overload with `QueryFeatureFields` is only on `ServiceFeatureTable`. As Antti noted, features must be loaded. `LoadAsync` on `ArcGISFeature` will do this as well, load all of feature attributes. This is available on features belonging to an `ArcGISFeatureTable` (i.e. ServiceFeatureTable, GeodatabaseFeatureTable).