When calling queryFeatures on a FeatureTable, not all attributes are loaded

504
2
Jump to solution
09-11-2018 08:32 AM
KeithLarson1
MVP

Hello all,

I am trying to query a FeatureTable in QML, so I pass it QueryParameters with the whereClause I need and it is giving me the correct amount of features. I have checked the fields property of both the table and the queryFeaturesResult and they both have the proper number of fields, which is 60 in this case. However, when I look at the attributes from the result, there are only 13 available.

I have had this problem in the past and was able to fix it, but I can't remember what I did. It is just very confusing that it does this, despite it knowing how many fields there are supposed to be, and that the only input I have is the QueryParameters which has no way of specifying the fields to return. Any help is appreciated.

Thanks,

Keith

0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

It sounds like the Feature objects in the result need to be loaded first before you can access all of its attributes. Are you using an online service (ServiceFeatureTable)? If so, you could try using the queryFeaturesWithFieldsOption - ServiceFeatureTable QML Type | ArcGIS for Developers 

With this, you can specify to use the Enums.QueryFeatureFieldsLoadAll enum (Enums.QueryFeatureFields enumeration | ArcGIS for Developers ) to make all features returned fully loaded. 

Otherwise, you could also go through the feature iterator and call load() on each. This is a bit more work because you will need to set up a signal handler for loadStatusChanged for each feature.

View solution in original post

2 Replies
LucasDanzinger
Esri Frequent Contributor

It sounds like the Feature objects in the result need to be loaded first before you can access all of its attributes. Are you using an online service (ServiceFeatureTable)? If so, you could try using the queryFeaturesWithFieldsOption - ServiceFeatureTable QML Type | ArcGIS for Developers 

With this, you can specify to use the Enums.QueryFeatureFieldsLoadAll enum (Enums.QueryFeatureFields enumeration | ArcGIS for Developers ) to make all features returned fully loaded. 

Otherwise, you could also go through the feature iterator and call load() on each. This is a bit more work because you will need to set up a signal handler for loadStatusChanged for each feature.

View solution in original post

KeithLarson1
MVP

Oh, thanks. I am using tables from a webmap, but they are from a feature service, so I was able to use queryFeaturesWithFieldsOption. Thanks again!

0 Kudos