Trouble retrieving Candidate fields from Geocode Service

Discussion created by gis_tech on Oct 14, 2011
Latest reply on Oct 14, 2011 by gis_tech
I�??ve got a Geocoding service that�??s working great for finding and displaying addresses out of a local SDE database.  For some reason, I�??m having trouble figuring out how to get the JavaScript syntax for returning all of the values that I need. 

The service properties list the Candidate fields as follows:

�?� Shape (Type: esriFieldTypeGeometry, Alias: Shape)
�?� Score (Type: esriFieldTypeDouble, Alias: Score)
�?� Match_addr (Type: esriFieldTypeString, Alias: Match_addr)
�?� House (Type: esriFieldTypeString, Alias: House)
�?� PreDir (Type: esriFieldTypeString, Alias: PreDir)
�?� PreType (Type: esriFieldTypeString, Alias: PreType)
�?� StreetName (Type: esriFieldTypeString, Alias: StreetName)
�?� SufType (Type: esriFieldTypeString, Alias: SufType)
�?� SufDir (Type: esriFieldTypeString, Alias: SufDir)
�?� City (Type: esriFieldTypeString, Alias: City)
�?� State (Type: esriFieldTypeString, Alias: State)
�?� ZIP (Type: esriFieldTypeString, Alias: ZIP)
�?� Ref_ID (Type: esriFieldTypeInteger, Alias: Ref_ID)
�?� User_fld (Type: esriFieldTypeString, Alias: User_fld)
�?� Addr_type (Type: esriFieldTypeString, Alias: Addr_type)

I�??m able to get the value for �??Score�?� to show up in the InfoTemplate object but for some reason, I�??m unable to grab the Match_addr value.  I�??ve got to be missing something obvious here in my syntax.  Any/all help is greatly appreciated. 
The relevant code snippit is below:

        function showResults(candidates) {
            var candidate;
            var symbol = new esri.symbol.SimpleMarkerSymbol();
            var infoTemplate = new esri.InfoTemplate("Location", "Address: ${Match_addr}<br />Score: ${score}<br />Source locator: ${locatorName}");

            symbol.setColor(new dojo.Color([153, 0, 51, 0.75]));

            var geom;

            dojo.every(candidates, function(candidate) {
                if (candidate.score > 80) {
                    var attributes = { address: candidate.Match_addr, score: candidate.score, locatorName: candidate.attributes.Ref_ID };
                    geom = candidate.location;
                    var graphic = new esri.Graphic(geom, symbol, attributes, infoTemplate);
                    //add a graphic to the map at the geocoded location 
                    //add a text symbol to the map listing the location of the matched address.
                    var displayText = candidate.Street;
                    var font = new esri.symbol.Font("16pt", esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL, esri.symbol.Font.WEIGHT_BOLD, "Helvetica");

                    var textSymbol = new esri.symbol.TextSymbol(displayText, font, new dojo.Color("#666633"));
                    textSymbol.setOffset(0, 8);
           esri.Graphic(geom, textSymbol));
                    return false; //break out of loop after one candidate with score greater  than 80 is found. 
            if (geom !== undefined) {
                map.centerAndZoom(geom, 12);


Link to my service:

Thanks a million, folks!