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.
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( "Location", "Address: ${address}<br />Score: ${score}<br />" );
var attribute3 = { "AccInfo": html3 }; //alert('acc attribute3'+attribute3); var infoTemplate3 = new InfoTemplate( "Account Info", "${AccInfo}<br/>" ); //alert('infotemplate acc '+infoTemplate3); arrayUtils.forEach(evt.addresses, function(candidate,index) { console.log(candidate.score); if (candidate.score > 80) { console.log(candidate.location); //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 map.graphics.add(graphic3); dojo.connect(map.graphics, "onMouseMove", function(evt) { var g = evt.graphic; map.infoWindow.setContent(g.getContent()); map.infoWindow.setTitle(g.getTitle()); map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint)); }); dojo.connect(map.graphics, "onMouseOut", function() {map.infoWindow.hide();} ); return false; //break out of loop after one candidate with score greater than 80 is found. }
I have a similar problem passing variables through the infoTemplate. Its like there's something funny happening with the scope. Certain variables work but when I get too crazy with them my map doesn't load.