QML selectFeaturesResult

02-19-2019 07:39 AM
Occasional Contributor

I am using code snippets from: arcgis-runtime-samples-qt/EditFeatureAttachments.qml at master · Esri/arcgis-runtime-samples-qt · Gi...  

And having issues with the:

var selectedFC = selectFeaturesResult.iterator.next();

qml: {"objectName":"","count":3,"attributesJson":{"firstname":null,"objectid":481199,"typdamage":"Minor"},"attributeNames":["firstname","objectid","typdamage"],"error":null}

does not have all the attributes from the feature layer.

Thank you,

0 Kudos
3 Replies
Esri Regular Contributor

I think you are missing a parameter that turns on and off what parameters that are showing, or to show all.

Looping in ArcGIS Runtime SDK for Qt

0 Kudos
Esri Frequent Contributor

If you need to get all fields, you will need to query the service. I've just noticed that we have an issue in our doc for ServiceFeatureTable that is missing this info, so I will work on getting this added.

What you will need to call is:

ServiceFeatureTable::queryFeaturesWithFieldOptions(QueryParameters parameters, Enums.QueryFeatureFields queryFeatureFields)

For QueryFeatureFields, use Enums.QueryFeatureFieldsLoadAll - Enums.QueryFeatureFields enumeration | ArcGIS for Developers 

In the case of this sample specifically, you could do the following workflow:

- mouseClick  -> perform identifyLayer

- once you get the feature back, call queryFeaturesWithFieldOptions using the unique ObjectID and the LoadAll enum

- Connect to ServiceFeatureTable::onQueryFeaturesStatusChanged and wait for it to complete

- Once complete, access all the fields, and call FeatureLayer::selectFeature with the supplied Feature object

Occasional Contributor

Added my test code to the repo:


would be nice if you could add your code where.

its a bit confusing because selectFeaturesResult and the IdentifyLayerResult returns QmlArcGISFeature()

and both have '.attributes'

Thank you,

0 Kudos