I'm working on putting some graphs on a webpage and I was following Selwyn's video examples. The problem I've run into is that when I do the a5_mergedataintotemplate and pass in the resultset from my query, the first result is being left out. I've confirmed that the data is there, it's just not being merged in. I tried a couple of different tests, one of which consisted of running a loop and checking the data output as text in the debugger. It looks like the merge is starting with the second row of data. Is anybody else experiencing this or have a workaround. I'm not able to set the current row in the result to the first and I don't see any other properties to force it to merge the first row of data.
I'm on Alpha Anywhere v4.5.5.0 build 5667
'open a connection
dim cn as sql::Connection
cn.open("::Name::IQMS-IQORA")
'execute the previously specified sql query
dim flag as l
flag = cn.Execute(sql)
'save the results from the qeury in a result set variable to read
dim rs as sql::ResultSet
rs = cn.ResultSet
debug(1)
dim test as c
test = "Name" + rs.data(1) + " " + rs.data(2) 'check if first row exists in results
while rs.NextRow() 'loop through results to see what comes up
test = "Name" + rs.data(1) + " " + rs.data(2)
end while
'declare a template to the save the data from the sql query for JSON
dim template as c
template = "['{js_escape(ds.data("mfgcell"))}', {ds.data("avgofoee_pct")}],"
'merge the reults from the result set into a text variable using the template format
dim txt as c
txt = a5_mergedataintotemplate(template, rs)
'trim the trailing comma off the result set
txt = rtrim(txt, ",")
'format the first row of the results with header names
txt = "[['Plant', 'Average OEE']," + txt + "]"
dim js as c
js = "dialog.object}._data = " + txt + ";"
e.javascript = js
I'm on Alpha Anywhere v4.5.5.0 build 5667
'open a connection
dim cn as sql::Connection
cn.open("::Name::IQMS-IQORA")
'execute the previously specified sql query
dim flag as l
flag = cn.Execute(sql)
'save the results from the qeury in a result set variable to read
dim rs as sql::ResultSet
rs = cn.ResultSet
debug(1)
dim test as c
test = "Name" + rs.data(1) + " " + rs.data(2) 'check if first row exists in results
while rs.NextRow() 'loop through results to see what comes up
test = "Name" + rs.data(1) + " " + rs.data(2)
end while
'declare a template to the save the data from the sql query for JSON
dim template as c
template = "['{js_escape(ds.data("mfgcell"))}', {ds.data("avgofoee_pct")}],"
'merge the reults from the result set into a text variable using the template format
dim txt as c
txt = a5_mergedataintotemplate(template, rs)
'trim the trailing comma off the result set
txt = rtrim(txt, ",")
'format the first row of the results with header names
txt = "[['Plant', 'Average OEE']," + txt + "]"
dim js as c
js = "dialog.object}._data = " + txt + ";"
e.javascript = js
Comment