APEX 4.2.6 on Linux Ora 12c
Working on implementing a google map demo at https://ruepprich.wordpress.com/?s=maps
I want to plot multiple addresses on google maps as multiple markers. I have an oracle table that has long and lats with addresses. Using the following query
Select '{name: '''||geo_description||' '',lat: '''||Substr(GEO_LOCATION,1,Instr(GEO_LOCATION,',')-1)||''',lng: '''||Substr(GEO_LOCATION,Instr(GEO_LOCATION,',')+1)||'''}'
From GEO_ADDRESS
returns
{name: 'Digicel 1 ',lat: '18.5563585',lng: '-72.25996719999999'}
{name: 'Digicel 2 ',lat: '19.7577071',lng: '-72.2013075'}
I put this in a PLSQL loop and return the string
{name: 'Digicel 1 ',lat: '18.5563585',lng: '-72.25996719999999'},{name: 'Digicel 2 ',lat: '19.7577071',lng: '-72.2013075'}
I can return it with or without '[',']' wrapped around the string.
I need to turn this string into a javascript object to use in a function defined in the apex page header attribute Functional and Global Variable Declaration
If I hardcode this in the js function declaration it works
var data = [{name: 'Digicel 1 ',lat: '18.5563585',lng: '-72.25996719999999'},{name: 'Digicel 2 ',lat: '19.7577071',lng: '-72.2013075'}] ;
but if I try to use a variable in the assignment it doesn't work
var data = "&P5_QUERY_TO_ARRAY.";
How do I convert the string to a object array so it will work in my javascript function?
I've tried the following and these DON'T work in APEX 4.2.6
var data = $.parseJSON('[' + datastring + ']');
var data = eval('(' + '&P5_QUERY_TO_ARRAY.' + ')');
var data = (new Function("return [" + objectstring + "];")());
I can't get the string into an object array which is needed for plotting multiple markers on Google maps
thanks in advance
PaulP