Question

I was looking over S.O. and found two questions that combined would solve a problem I am having. I would like to post pct markers onto google map from Apex report.

passing variable from report works.. javascript:LOCATION(#LOCATION#);

but I can't seem to get the javascript to run. thanks

<script type="text/javascript">
function LOCATION(pLoc){  
var Loc = (pLoc);
var locations = ['+Loc+'];
var map = new google.maps.Map(document.getElementById('map'), {
  zoom: 10,
  center: new google.maps.LatLng(-33.92, 151.25),
  mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();

var marker, i;

for (i = 0; i < locations.length; i++) {  
  marker = new google.maps.Marker({
    position: new google.maps.LatLng(locations[i][1], locations[i][2]),
    map: map
  });
  google.maps.event.addListener(marker, 'click', (function(marker, i) {
    return function() {
      infowindow.setContent(locations[i][0]);
      infowindow.open(map, marker);
    }}
  })(marker, i));
 }
}
</script>

thanks for your time.

Was it helpful?

Solution

Your Query:

SELECT stragg(a.location) as location, a.region 
FROM
(SELECT DISTINCT rownum
      , '['||''''||'test'||''''|| c.lon ||','|| c.lat ||', '||rownum|| ']' as location
      , a.pct_name
      , b.election_code_id
      , c.region 
  FROM ecms.prv_pcts a
     , ecms.sites_assign b
     , ecms.sites_details c 
 WHERE b.site_id = c.site_id 
   AND b.pct_id  = a.prv_pct_id 
   AND a.pct_name NOT LIKE 'ALL PR%' 
   AND b.election_code_id IS NOT NULL
   AND b.election_code_id = '117' 
 ORDER by 1, 2
) a 
GROUP BY a.region 

Would give an output of:

['testLON',LAT,1],['testLON2',LAT2,2]

Calling function LOCATION with these values would provide the function with multiple parameters. Thus, locations[][] wouldn't exactly work as pLoc is not an array holding arrays. You could fix this by using

SELECT '['||stragg(a.location)||']' as location, a.region 

Also,

  • var locations = ['+Loc+']; kind of defeats the purpose, no?
  • DISTINCT ROWNUM?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top