AnsweredAssumed Answered

Tree has duplicate records

Question asked by Mr_Kirkwood on Mar 12, 2015
Latest reply on Mar 20, 2015 by Mr_Kirkwood

I created a tree and it is populating duplicate records. Here is a screenshot:

 

treeData2.JPG

 

The records correspond to the amount of features identified. here is the code:

 

if (map.getLayer("waterResources").visibleLayers.length > 0) {
            //Water
            var idWaterTask = new IdentifyTask(urlWaterResources);
            var idWaterParams = new IdentifyParameters();
            idWaterParams.tolerance = 1.2;
            idWaterParams.returnGeometry = false;
            //idWaterParams.spatialReference = map.spatialReference;
            idWaterParams.layerIds = map.getLayer("waterResources").visibleLayers;
            idWaterParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
            idWaterParams.mapExtent = map.extent;
            idWaterParams.geometry = inPnt;
            waterResources = idWaterTask.execute(idWaterParams, function (result) {


                for (var i = 0; i < result.length; i++) {
                    if (result[i].layerName === "SEO Wells (zoom in for points)") {
                        var layerName1 = result[i].layerName;
                        var layerName2 = result[i].value;
                        if (document.getElementById(layerName1 + 'CB').checked === true) {
                            myData.push({id: layerName1, name: "SEO Well - " + layerName2, parent: 'All', children: true});
                            //Convert features object into array to pass to for each to process
                            for (var key in result[i].feature.attributes) {
                                if (result[i].feature.attributes.hasOwnProperty(key)) {
                                    if (key === "OBJECTID" || key === "Shape_Leng" || key === "OBJECTID_1" || key === "Shape") {
                                    } else {
                                        var k = key;
                                        var v = result[i].feature.attributes[key];
                                        if (k === "Hyperlink" || k === "URL") {
                                            myData.push({id: k + v, name: k + " - " + "<i><u>Click here for more information</u></i>", url: v, children: false, parent: layerName1});
                                        }
                                        else {
                                            myData.push({id: k + v, name: k + " - " + "<i>" + v + "</i>", children: false, parent: layerName1});
                                        }
                                    }
                                }
                            }
                        }
                    }

Outcomes