Hi All,
I am getting the value from the attribute table using ArcGIS JS API. I want to list all the values in a particular column.Ex: column called Location is present in the Attribute table and values are present. Now, I want to extract the value of column Location.
Purpose:
Extracted value has to be binded with DropDownlist, So the user can select Location wise. the below function act as datasource to DropdownList
Code Tried:
var queryTask = new QueryTask("https://Domain.org/agswa/rest/services/MP_Practise/Deployment/MapServer/0");
var query = new Query();
// query.objectIds = [2]; //HardCode - has to list all locations
query.outFields = ["Location"];
query.returnGeometry = true;
queryTask.on("complete", queryTaskExecuteCompleteHandler);
queryTask.on("error", queryTaskErrorHandler);
queryTask.execute(query, showResults);
function queryTaskExecuteCompleteHandler(queryResults) {
console.log("complete", queryResults);
}
function queryTaskErrorHandler(queryError) {
console.log("error", queryError.error.details);
}
Note: If the ObjectId line is uncommented, It extracts single value corresponding to ObjectId.
Thanks In Advance
Hello Mathan,
Could you be more specific about, what issues you are have and what you need from us?
Regarding the objectid property, it is working as expected. Since, you are passing one id, it is returning the record with that object id, in you case OBJECTID = 2.
~Thejus
Thanks Thejus Kambi,
I am trying to get ALL values (List) from the attribute table, column named called Location. Need to bind with the DropDownList, So the user can select the location. According to above code, OBJECTID = 2 brings SINGLE row as if like WHERE clause. My scenario, I will not mention OBJECTID.