AnsweredAssumed Answered

How to replace "0" field value with text in popup window

Question asked by dknigge on Aug 6, 2012
Latest reply on Aug 14, 2012 by dknigge
Parcel acreage is not always supplied by the Assessors office and will therefore have a "0" value (not null).
I have tried adjusting the function below to work with the "0" value but am not having much success.  Could someone help me?

  deferred.addCallback(function(response) {    
             return dojo.map(response, function(result) {
            var feature = result.feature;
            feature.attributes.layerName = result.layerName;
            if(result.layerName === 'House Numbering'){
            console.log(feature.attributes.OBJECTID);
            var template = new esri.InfoTemplate("", "<b>Parcel Information</b><hr><br />Parcel ID:${PREFIX} <br /> Zoning: ${ZONING} <br /> Acreage: ${ACREAGE:calculateAcre} <br /> Address: ${ADDRESS} <br /> City: ${ZIP_CITY}  <br /> Zip Code: ${ZIP_CODE}");
            feature.setInfoTemplate(template);
     
            }
  
  if(result.layerName === 'General Plan'){
              console.log(feature.attributes.OBJECTID);
              var template = new esri.InfoTemplate("", "<b>General Plan Designation</b><hr><br />General Plan:${GP96} <br /> Description: ${Description}");
              feature.setInfoTemplate(template);
            }
  
             else if (result.layerName === 'General_Plan_Overlays'){
              var template = new esri.InfoTemplate("", "<b>General Plan Overlays</b><hr><br />Overlay: ${GP96}");
              feature.setInfoTemplate(template);
            }
            return feature;
          });
        });

        function calculateAcre(value,key,data){
        return data.ACREAGE == '0' ? data.ACREAGE : 'Not Available';
     
      }

Outcomes