Non Address information on the infotemplate to be linked to the addresses located

Discussion created by mapsunithakrishna on Feb 6, 2014
Latest reply on Feb 25, 2014 by

I am trying to link Account Name to accounts whose addresses are located on a map by using the addresstolocate(accountaddress) using arcgis javascrip API. However,the functions linked to this has information about address,score and location.

How Can I pass account name information so that the address lcoated on the map corresponding to the account is displayed on the map.

here is further details.

address 2 is the account address that got by iterating the result set from the sql query.

       locator1.on("address-to-locations-complete", showResultsAcc);

i want to pass account name to few more parameter to the infotemplate by using the html variable

var html3="<div style=\"float:left;\"><div style=\"font-family: arial, san-serif; padding-left:30px;\"><span style=\"font-weight:bold;\"><a href='/{!account.ID}' target='_blank'>{!account.Name} </a></span><br/>";

however only a single/last account name is getting linked to the template and it is not dispalying the account name for all the located addresses.

Please Note: WHen there is an alert () message between the start on the ShowTResult functions teh functioanloty workes but without alert it does not. So I thought it might be due to some delay in the world geocode service and addes some delay but that did not work for me.

Request you to please provide a solution as I have spent a lot of time on this.

The ShowResultsAcc does the task of adding the graphic to the map with the information template.

function showResultsAcc(evt) {
    //alert('Inside acc');
          var candidate;
          var infoTemplate = new InfoTemplate(
            "Address: ${address}<br />Score: ${score}<br />"

          var geom;

                var symbol3 = new esri.symbol.PictureMarkerSymbol('', 32, 32);
       //alert('html acc'+html3);       

       var attribute3 = {
                "AccInfo": html3
         //alert('acc attribute3'+attribute3);      
            var infoTemplate3 = new InfoTemplate(
            "Account Info",
          //alert('infotemplate acc '+infoTemplate3);
          arrayUtils.forEach(evt.addresses, function(candidate,index) {
            if (candidate.score > 80) {
     //alert('score greater account'+candidate.geometry);
              var attributes = {
                address: candidate.address,
    geom = candidate.location;
              //alert('geom in Acc'+geom);
              var graphic3 = new esri.Graphic(geom,symbol3,attribute3,infoTemplate3);
              //alert('acc graphics'+graphic3);
              //add a graphic to the map at the geocoded location
  dojo.connect(, "onMouseMove", function(evt) {
          var g = evt.graphic;
        dojo.connect(, "onMouseOut", function() {map.infoWindow.hide();} );
              return false; //break out of loop after one candidate with score greater  than 80 is found.