Folks
If you get a chance please point me the way on loading dynamic values into the app, on startup, from an external SQL Server db.
Effort in the txt file
Thanks
Keith
It looks like you're on the right track. I moved where you return your promise:
function GetDatabaseValue(_newcity) { var def = new Deferred(); var c = _newcity; var qTask = new QueryTask("http://localhost:6080/arcgis/rest/services/ggov_DatabaseValues/MapServer/2"); var QT = new Query(); QT.returnGeometry = false; QT.outFields = [ "CityName", "Html", "Picture", "Link", "Extent" ]; QT.where = "CityName = '" + c + "'"; qTask.execute(QT, function (results) { //console.log(results); var CityExtent; var resultItems = []; var resultCount = results.features.length; for (var i = 0; i < resultCount; i++) { var featureAttributes = results.features.attributes; for (var attr in featureAttributes) { if (attr == "Extent") { CityExtent = featureAttributes[attr]; //console.info(CityExtent + " GetDatabaseValue"); } } } def.resolve(CityExtent); // REMOVE --> return def.promise; }); //End of function results return def.promise; // <------ ADD } // End Function GetDatabaseValue()
Josh
Thank you good friend!
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.