AnsweredAssumed Answered

Fetching data from DOM.

Question asked by manoharm_UN on Jan 27, 2017

Hi All,

I had created an application using ArcGIS Portal/Web App Builder 2.0. Now I have to create the Reports.

 

Implemented:

In WebAppBuilder, I had published the map service and added in the webappbuilder and symbologies are visible, I can View/Edit data using Widgets. Since, No Reports are available, I created an HTML page and used the  

var queryTask = new QueryTask and obtained the records from the attribute table.

 

Code:

var queryTask = new QueryTask("https://domain.com/agswa/rest/services/Practise/Deployment/MapServer/0");

var query = new Query();
query.returnGeometry = false;
query.outFields = [
"OBJECTID", "Type", "Location", "Status", "Office_Type",
"Country", "Strength"
];

on(dom.byId("execute"), "click", execute);

function execute () {
query.text = dom.byId("Location").value;
// query.where = "XYZ"; --Error
queryTask.execute(query, showResults);
}

function showResults(results) {
var resultItems = [];
var resultCount = results.features.length;
for (var i = 0; i < resultCount; i++) {
var featureAttributes = results.features[i].attributes;
for (var attr in featureAttributes) {
resultItems.push("<b>" + attr + ":</b> " + featureAttributes[attr] + "<br>");
}
resultItems.push("<br>");
}
dom.byId("info").innerHTML = resultItems.join("");
}

 

Query:

1. Can fetch the desired data from DOM like, Location and its related data [Since for reports, I am pointing to published map server and fetching the same data again]

2. If yes, Data can be fetched through DOM, How to fetch the data from DOM.?

3. I placed the filter // query.where = "XYZ"; - Show error, even though data is present.

Outcomes