When I run a query, I have one of the values already selected that would be returned. If I populate my form as is, one of the values will be the selected item meaning it will be displayed twice. How do I exclude it for my first navigation, but display it if I navigate back to it?
Here is the code:
// Show supports form for updating document.getElementById("btnSupportUpdate").style.visibility = "visible"; app.attributesModal.modal("show"); ii = -1; }); /* Update Support Layer End */ // Cycle through sign information with the previous button on(dom.byId("btnSupportPrevious"),"click",function(){ console.log("Previous Works"); var query = new esriQuery(); var queryTask = new QueryTask(config.signLayerUrl); query.returnGeometry = false; query.outFields = ["*"]; query.where = "SUPPORTID = " + dom.byId("supportId").value; queryTask.execute(query, function (results) { ii--; // Attempting to know how many signs are in my results // Use gettArray.html to get array values var resultItems = []; var resultCount = results.features.length; if (ii > -1) { console.log("Results start now!"); console.log(results); var featureAttributes = results.features[ii].attributes.GLOBALID; for (var attr in featureAttributes) { console.log("Attribute: " + featureAttributes); } } else { console.log("This is where you will get the support information"); //document.getElementById("btnSupportNext").disabled = true; } }) });
Solved! Go to Solution.
It does. I was thinking maybe I needed to evaluate the first object for signs or the one displayed. That way it would not repeat by checking ObjectId. Is that what you meant?
Yes. you need to compare the ObjectId of the clicked object with the one from Query and set the value of ii variable to the appropriate index. so that your next/previous will work like normal.
That will work. I'll give it a go. Thanks.