Select to view content in your preferred language

How do I navigate through attributes to populate a form?

5657
23
Jump to solution
07-15-2015 12:18 PM
ChrisSergent
Regular Contributor III

I want to obtain the attribute information of the following:

features.png

With the following code I can get the GLOBALID, but I am in need of each attribute. I commented out what I tried to add. It did not work. For now, if you can give me an idea on how to do a second one, I can do the rest. Here is my code:

 on(dom.byId("btnSignPrevious"), "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("signSupportId").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;
                    //var attachLoc = results.features[ii].attributes.ATTACHLOC;
                    for (var attr in featureAttributes) {
                        console.log("Attribute: " + featureAttributes);
                        
                    }


                    //for (var attr in attachLoc) {
                    //    console.log("ATTACHLOC:" + featureAttributes);
                    //}


                } else {
                    console.log("This is where you will get the support information");
                    //document.getElementById("btnSupportNext").disabled = true;
                }




            })
        });

And here is the release on github that matches this code: csergent45/streetSigns at db8123a8c67514aefd8739743fe75880e23f31e7 · GitHub

0 Kudos
23 Replies
ChrisSergent
Regular Contributor III

Okay, I will give it a go and update my code tomorrow. One last thing. If I want to populate the form on load, should this block of code work before I start my loop as well since the variable ii has a value already?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sure

0 Kudos
ChrisSergent
Regular Contributor III

I will be updating this today. I may have to change this Tim Witt​. The textboxes weren't filling in the other way.

0 Kudos
ChrisSergent
Regular Contributor III

It looks like it's working, but we have some test data that may have duplicates it, so I will need to work with that and clean it up. Thanks.

0 Kudos