QML selectFeaturesResult

507
3
02-19-2019 07:39 AM
LaurynasGedminas2
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();
console.log(JSON.stringify(selectedFC.attributes);
//////

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
ErwinSoekianto
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
LucasDanzinger
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

LaurynasGedminas2
Occasional Contributor

Added my test code to the repo:

https://github.com/goriliukasbuxton/qml_selection/blob/master/MyApp.qml#L86

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