Select to view content in your preferred language

Xamarin: Feature Layer not returning custom Attributes

1829
6
Jump to solution
04-25-2017 02:36 PM
brianbullas
Deactivated User

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
}
0 Kudos
1 Solution

Accepted Solutions
JenniferNery
Esri Regular Contributor

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...

View solution in original post

6 Replies
JenniferNery
Esri Regular Contributor

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...

brianbullas
Deactivated User

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);
0 Kudos
DavidHaines
Regular Contributor

It would be helpful to include this option in the samples, as I think most people would expect LoadAll to be the default.

0 Kudos
DavidPeña1
New Contributor

Hello,

Is there any similar method if I am working with FeatureLayer from mmpk?

Thanks

0 Kudos
AnttiKajanus1
Deactivated User

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.

JenniferNery
Esri Regular Contributor

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).

0 Kudos