AnsweredAssumed Answered

Binded two stored procedures from sql to same one map, but while coming to infowindow only one stored procedure is working, need to show different values depending on graphic

Question asked by mallareddy2271 on Jun 26, 2017
Latest reply on Jun 27, 2017 by thejus.kambi

//Same information on every point only first Json Markers(data) is showing for all points

var map;
require([

 

], function (
Map, Scalebar, graphicsUtils, Extent, InfoTemplate, SimpleLineSymbol, Graphic, SimpleMarkerSymbol, Color, on, dom, Point, Search
) {
var markers = JSON.parse('<%=GetData1() %>'); //getting data from sql
var outfall = JSON.parse('<%=GetData2() %>');//getting data from sql
map = new Map("FSMap", {
basemap: "osm",
center: [-y, x],
zoom: 6
});
map.on("load", addQueryResult);
function addQueryResult() {
if (markers && markers.length > 0) {
for (i = 0; i < markers.length; i++) {
var data = markers[i]
var lat = data.latitude;
var long = data.longitude;
var symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE, 4,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([128, 0, 128])));
var pt = new Point(long, lat);
var graphic = Graphic(pt, symbol, data);
map.graphics.add(graphic);
map.on("click", Pointdata);
function Pointdata(evt) {
if (evt.graphic) {
var latitude = evt.mapPoint.getLatitude();
var longitude = evt.mapPoint.getLongitude();
map.infoWindow.setTitle("Details");
map.infoWindow.setContent(evt.graphic.attributes.FId+ '<br>' + 'Address:' + evt.graphic.attributes.StreetAddress 
);
map.infoWindow.show(evt.mapPoint, map.getInfoWindowAnchor(evt.screenPoint));
}
}
}
}
if (outfall && outfall.length > 0) {
for (i = 0; i < outfall.length; i++) {
var Info = outfall[i]
var lati = Info.LatitudeDecimal;
var longi = Info.LongitudeDecimal;
var green = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 11,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([0, 128, 0]), 2));));
var pnt = new Point(longi, lati);
var graphi = Graphic(pnt, green, data);
map.graphics.add(graphi);
map.on("click", Outfalldata);
function Outfalldata(evt) {
if (evt.graphi) {
var latitude = evt.mapPoint.getLatitude();
var longitude = evt.mapPoint.getLongitude();
map.infoWindow.setTitle("OutfallDetails");
map.infoWindow.setContent(evt.graphi.attributes.PId
);
map.infoWindow.show(evt.mapPoint, map.getInfoWindowAnchor(evt.screenPoint));
}
}
}
}
}
});

Outcomes