AnsweredAssumed Answered

unable to get feature when i select a value in second drop box

Question asked by satyanarayana_narmala on Dec 19, 2019
Latest reply on Dec 23, 2019 by rscheitlin

Hi all,

i have 2 layers, zone and circle. when i filter (filter.png)  zone select a name it will zoom to that particular zone and print on console as 1. And when i select zone and circle combination only 0 zero records is fetched as seen in console (s.png).

 

 

$(document).on("change", "#Zone_list", function () {
                if ($("#Zone_list").val() == "All Zones") {
                    $("#Circle_list").empty();
                    $("#table_title").text("All Zones");
                    map.addLayer(district_layer);
                    map.removeLayer(mandal_layer);
                    map.setExtent(district_layer.fullExtent);
                    basicOnLoadFun();
                } else {
                    $("#table_title").text("Zone: " + $("#Zone_list :selected").text());
                    setMapFeatureToExtent(QueryTask, Query, district_url, 'sde.sde.ghmc_zones_pt1.zoneid = ' + $("#Zone_list").val());
                    var query_con = 'sde.sde.GHMC_Circles_pt1.zone_id = ' + $("#Zone_list").val();
                   
                    selectedDistrict(query_con);
                }
            });

 

            $(document).on("change", "#Circle_list", function () {
                if ($("#Circle_list").val() == "All Circles") {
                    setMapFeatureToExtent(QueryTask, Query, district_url, 'sde.sde.ghmc_zones_pt1.zoneid = ' + $("#Zone_list").val());
                } else {
                    var condition = 'sde.sde.GHMC_Circles_pt1.circle = ' + $("#Circle_list").val() + ' AND sde.sde.GHMC_Circles_pt1.zone_id = ' + $("#Zone_list").val();
                
                    setMapFeatureToExtent(QueryTask, Query, mandal_url, condition);
                    
                }
            });

 

            function selectedDistrict(query_con) {
                map.removeLayer(district_layer);
                mandal_layer.setDefinitionExpression(query_con);
                map.addLayer(mandal_layer);
                field_key = "sde.sde.circlepara." + $('input[name=Indecator]:checked').val();
                var out_fields = "sde.sde.GHMC_Circles_pt1.zone || sde.sde.GHMC_Circles_pt1.zone_id || sde.sde.GHMC_Circles_pt1.cir_name || sde.sde.GHMC_Circles_pt1.circle ||
                getAttributes(Query, QueryTask, query_con, mandal_url, "sde.sde.GHMC_Circles_pt1.cir_name||sde.sde.GHMC_Circles_pt1.circle", "#Circle_list", "Circles");
              
             
                createTable(QueryTask, Query, mandal_url, query_con, out_fields);
            };

 

            function setMapFeatureToExtent(QueryTask, Query, url, condition) {
                var queryTask = new QueryTask(url);
                var query = new Query();
                query.returnGeometry = true;
                query.outFields = ["*"];
                query.outSpatialReference = map.spatialReference;
                query.where = condition;
                
                queryTask.execute(query, function (results) {
                    console.log(results.features.length)
                    map.setExtent(results.features[0].geometry.getExtent())
                });
            };

Attachments

Outcomes