ServiceFeatureTable {
id: workLogTable
url: ""
credential: Credential {
username: ''
password: ''
}
onQueryFeaturesResultsChanged: {
if (queryFeaturesStatus === Enums.TaskStatusCompleted) {
if (!queryFeaturesResult.iterator.hasNext) {
return;
}
workLog.clearSelection();
var features = []
while (queryFeaturesResult.iterator.hasNext) {
features.push(queryFeaturesResult.iterator.next());
}
workLog.selectFeatures(features);
var identifiedObjects =[]
var elem = features[0];
identifiedObjects.push(elem);
displayAttributesModel.append(elem);
for (z = 0; z < displayAttributesModel.rowCount(); z++) {
console.log(JSON.stringify(displayAttributesModel.get(z).attributes.attributeNames))
}
}
}
}
I have this code that is being invoked
params.whereClause = "GlobalID = '" + activeID+"'" ;
workLogTable.queryFeatures(params); I have all these fields
So the line
console.log(JSON.stringify(displayAttributesModel.get(z).attributes.attributeNames))
is only outputting
qml: {"0":"created_date","1":"created_user","2":"CREW_RESPONDING","3":"GlobalID","4":"last_edited_date","5":"last_edited_user","6":"OBJECTID"}
meaning the majority of my fields aren't being returned. So attribute values I need to display are not being displayed in my app.
Is this a known issue? Is there a way to solve it and return all fields?
Solved! Go to Solution.
Sure. All you need to do is replace this:
params.whereClause = "GlobalID = '" + activeID+"'" ;
workLogTable.queryFeatures(params);
with this:
params.whereClause = "GlobalID = '" + activeID+"'" ;
workLogTable.queryFeaturesWithFieldOptions(params, Enums.QueryFeatureFieldsLoadAll);
If I'm understanding this correctly, this is the same problem I was having before. I was able to specify the fields to return with the queryFeaturesWithFieldOptions function rather than queryFeatures. I passed it Enums.QueryFeatureFieldsLoadAll to return all fields. It is documented here: ServiceFeatureTable QML Type | ArcGIS for Developers . Hope that helps.
Could you post an example of how you used it?
Sure. All you need to do is replace this:
params.whereClause = "GlobalID = '" + activeID+"'" ;
workLogTable.queryFeatures(params);
with this:
params.whereClause = "GlobalID = '" + activeID+"'" ;
workLogTable.queryFeaturesWithFieldOptions(params, Enums.QueryFeatureFieldsLoadAll);
Thank you, such a simple soultion
I think this is similar to this thread, How to use QueryParameters and specify outFields?
It is because there is no outfields parameter being set, someone has reported success using "queryFeaturesWithFieldOptions" method which will return all fields.