I have written my code for unique values and get the count for each layer.The problem which i am getting is that my field "SubtypeCD" is domain coded value.
Following code is for unique value :
var unique = new QueryTask("http://localhost:6080/arcgis/rest/services/mydata/MapServer/1");
var query = new Query();
query.returnGeometry = false;
query.returnDistinctValues = true;
query.outFields = [
"SubtypeCD"
];
execute();
function execute () {
query.where = '1=1';
unique.execute(query, showResults);
}
var resultItems = [];
function showResults (results) {
var resultCount = results.features.length;
for (var i = 0; i < resultCount; i++) {
var featureAttributes = results.features.attributes;
for (var attr in featureAttributes) {
resultItems.push( featureAttributes[attr] );
}
}
console.log(resultItems);
}
The output i am getting in resultItems are 1,2 as my field is domain coded. What i need is to read the value name description which is PMT and GMT.