i am attempting to create a google time line chart from data in a list control, but have trouble getting the date fields for the list.
var strdata = "['Well_Name','Startdate','Enddate'],"
var lObj = {dialog.object}.getControl('list1');
//number of rows in list.
var count = lObj._rData.length;
if (count == 0)
{
{dialog.Object}.setValue('PLACEHOLDER_1','No data found in your list. Check your data or filter settings' );
{dialog.Object}.setControlDisplay('STATICTEXT_1',false)
return;}
{dialog.Object}.setControlDisplay('STATICTEXT_1',false)
//Loop through all rows of the list and build the array string.
for (i=0;i<count;i++) {
strdata = strdata + "['" + lObj.getData(i).Well_Name + "','" + lObj.getData(i).Startdate + "','" + lObj.getData(i).enddate + "']," ;
}
//remove last comma from bottom row.
strdata = strdata.substring(0, strdata.length - 1);
//enclose in brackets
strdata="[" + strdata + "]";
{dialog.Object}.setValue('PLACEHOLDER_1',strdata);
//This the key command that converts the string variable to a javascript object that google can consume as a parameter
//Without this command, I kept getting "not an array error"
var chartdataObj = eval ("(" + strdata + ")");
//PLACEHOLDER_1 used for no records found message. Clear any value
{dialog.Object}.setValue('PLACEHOLDER_1','');
window.alert(strdata);
the window alert shows the string in proper format but where the dates should be shows "undefined"
Screen.png
var strdata = "['Well_Name','Startdate','Enddate'],"
var lObj = {dialog.object}.getControl('list1');
//number of rows in list.
var count = lObj._rData.length;
if (count == 0)
{
{dialog.Object}.setValue('PLACEHOLDER_1','No data found in your list. Check your data or filter settings' );
{dialog.Object}.setControlDisplay('STATICTEXT_1',false)
return;}
{dialog.Object}.setControlDisplay('STATICTEXT_1',false)
//Loop through all rows of the list and build the array string.
for (i=0;i<count;i++) {
strdata = strdata + "['" + lObj.getData(i).Well_Name + "','" + lObj.getData(i).Startdate + "','" + lObj.getData(i).enddate + "']," ;
}
//remove last comma from bottom row.
strdata = strdata.substring(0, strdata.length - 1);
//enclose in brackets
strdata="[" + strdata + "]";
{dialog.Object}.setValue('PLACEHOLDER_1',strdata);
//This the key command that converts the string variable to a javascript object that google can consume as a parameter
//Without this command, I kept getting "not an array error"
var chartdataObj = eval ("(" + strdata + ")");
//PLACEHOLDER_1 used for no records found message. Clear any value
{dialog.Object}.setValue('PLACEHOLDER_1','');
window.alert(strdata);
the window alert shows the string in proper format but where the dates should be shows "undefined"
Screen.png
Comment