3

Through some console.log debugging I've located the exact line of code that is failing me but I'm not quite sure how to fix the problem.

Basically, I have an identify function that queries the parcels layer on click and returns the specified field values in an infoWindow popup. When testing, I noticed that sometimes it will return "no information available" instead of the actual data. If you attempt enough times, it will eventually give you the data. I'd like to prevent this from happening and I should never see "no information available" as the parcels layer has no gaps.

Here's the code:

function executeIdentifyTask(evt) {
 if (map.infoWindow.count == 0 && map.__LOD.level > 14) {
 console.log("debug 1");
 var tms;
 showLoader();
 identifyParams.geometry = evt.mapPoint;
 identifyParams.mapExtent = map.extent;
 identifyTask.execute(identifyParams, function(results) {
 var features = [];
 var commonContent = '';
 var zoneContent = '';
 var munContent = '';
 var zipContent = '';
 var mCheck = 0;
 console.log("debug 2");
 dojo.forEach(results, function(result) {
 if (result.layerName === "Council Districts" && mCheck == 0) {
 console.log("2.1");
 commonContent += "<tr><td>Council District Name: </td><td>" + result.feature.attributes['Label'] + " </td></tr> <tr><td>Council District Population: </td><td>" + result.feature.attributes['Population'] + " </td></tr> ";
 mCheck++;
 } else if (result.layerName === "Parcels") {
 features.push(result);
 }
 });
 dojo.forEach(results, function(result) {
 if (result.layerName === "Zoning") {
 console.log("2.2");
 zoneContent += "<tr><td>Zone: </td><td>" + result.feature.attributes['ZoningCode'] + "</td></tr> ";
 }
 });
 dojo.forEach(results, function(result) {
 if (result.layerName === "Zipcodes") {
 console.log("2.3");
 zipContent += "<tr><td>Zip Code: </td><td>" + result.feature.attributes['ZIPCODE'] + "</td></tr> ";
 }
 });
 dojo.forEach(results, function(result) {
 if (result.layerName === "Municipalities") {
 console.log("2.4");
 munContent += "<tr><td>Municipality: </td><td>" + result.feature.attributes['NAME'] + "</td></tr> ";
 }
 });
 results = dojo.map(features, function(result) {
 console.log("2.5");
 var feature = result.feature;
 console.log("2.6");
 var content = '';
 console.log("llllllll 2.7");
 if (result.layerName === "Parcels") {
 console.log("2.8");
 content += '<table cellpadding="3" cellspacing="0" border="0" class="infoData" id="infoData" >';
 content += "<tr><td>Owner Name:</td><td>" + result.feature.attributes['ONAME'] + "</td>";
 content += "<tr><td>PIN:</td><td>" + result.feature.attributes['PIN'] + "</td></tr>";
 content += "<tr><td>TMS:</td><td>" + result.feature.attributes['TMS'] + "</td></tr>";
 content += "<tr><td>Lot:</td><td>" + result.feature.attributes['LOT'] + "</td></tr>";
 content += "<tr><td>Parcel Type:</td><td>" + result.feature.attributes['PARCELTYPE'] + "</td></tr>";
 content += munContent;
 content += zipContent;
 content += "<tr><td>District:</td><td>" + result.feature.attributes['DIST'] + "</td></tr>";
 content += zoneContent;
 content += "<tr><td>Legal Description</td><td>" + result.feature.attributes['GRM_LegalDesc'] + "</td></tr>";
 content += "<tr><td>Square Footage:</td><td>" + result.feature.attributes['SHAPE.area'] + "</td></tr>";
 content += "<tr><td>Acreage:</td><td>" + result.feature.attributes['RE_acres'] + "</td></tr>";
 content += commonContent;
 content += "<tr><td>Owner Address:</td><td>" + result.feature.attributes['MADD'] + "</td></tr>";
 content += "<tr><td>City:</td><td>" + result.feature.attributes['CITY'] + "</td></tr>";
 content += "<tr><td>State:</td><td>" + result.feature.attributes['STATE'] + "</td></tr>";
 content += "<tr><td>ZIP:</td><td>" + result.feature.attributes['Zip'] + "</td></tr>";
 content += "<tr><td>Map Sub Block:</td><td>" + result.feature.attributes['MAPSUBBLOCK'] + "</td></tr>";
 content += "<tr><td>Condo Label:</td><td>" + result.feature.attributes['CONDOLABEL'] + "</td></tr>";
 content += "<tr><td>Lots:</td><td>" + result.feature.attributes['RE_lots'] + "</td></tr>";
 content += "<tr><td>Deed Book:</td><td>" + result.feature.attributes['DeedBook'] + "</td></tr>";
 content += "<tr><td>Deed Page:</td><td>" + result.feature.attributes['DeedPage'] + "</td></tr>";
 content += "<tr><td>Date Sold:</td><td>" + result.feature.attributes['SaleDate'] + "</td></tr>";
 content += "</table>";
 var template = new esri.InfoTemplate(result.feature.attributes['TMS'], content);
 feature.setInfoTemplate(template);
 tms = result.feature.attributes['TMS'];
 console.log("debug 3");
 if (onBase == 1) {
 console.log("3.1");
 var featPropsArray = new Array();
 var featProp = new Object();
 featProp.Key = "TMS";
 featProp.Value = tms;
 featPropsArray.push(featProp);
 g_featPropsArray = featPropsArray;
 OB_GenerateHitListForFeature(g_JSON_OB_GIS_URL, g_featPropsArray, "Parcels", "search_results", null);
 if (!$(this).hasClass("shown"))
 moveLegend(0);
 $('#tabs').tabs('select', 1);
 hideLoader();
 }
 return feature;
 }
 });
 console.log("debug 4");
 map.infoWindow.setFeatures(results);
 console.log("debug 5");
 map.infoWindow.show(identifyParams.geometry);
 console.log("debug 6");
 hideLoader();
 });
 } else if (map.infoWindow.count == 0 && map.__LOD.level <= 14) {
 console.log("Need to zoom in to identify.")
 } else {
 console.log("debug 7");
 map.infoWindow.clearFeatures();
 console.log("debug 8");
 //map.infoWindow.destroy();
 map.infoWindow.hide();
 console.log("debug 9");
 executeIdentifyTask(evt);
 console.log("debug 10");
 }
}

When all executes successfully, the entirety of the code is run. When I get "no information available" the results block of code is skipped entirely.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Aug 6, 2014 at 18:43
3
  • Add an errback function after the callback function (which is what you have currently). When the callback is not fired, that means there's an error, and you can capture the error details via the errback function. See the [docs] (developers.arcgis.com/javascript/jsapi/…) for more. Commented Aug 6, 2014 at 21:25
  • So I may not be using the errback correctly but as I have it I'm not getting any information about the error. Here is just the errback code I'm using: function(error){ console.log("Error - "+error); console.log("Error code - " +error.code); }); I'm not sure I'm actually hitting an error though as it's just skipping part of the code and still producing the infowindow- just without the data in it. Commented Aug 7, 2014 at 14:07
  • How are you getting the data? Do you use ajax? Commented Mar 10, 2018 at 9:48

1 Answer 1

1

I usually get this when something is null along the way (browser fails, no message, hard to debug);

My suggestion is to start by hitting F12 for the debug tools (chrome, FF, IE all use this), put a breakpoint at the start of your id results function and inspect your variable (mouse over or add a watch).

I'd personally make a few style changes but my main suggestion is that your template can use placeholders ( "I have a ${var1} and it is {$var2}..." ) that will make your code easier to read.

answered Aug 19, 2014 at 14:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.