Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

VBS Expected Statement error

$
0
0

IHi there:

Hi there:

I am trying to build an XML file from a string and I am getting a Expected Statement Error.  I am not sure what

is wrong that would cause this error with a simple loop for a bar graph.  Any ideas?

Thanks in advance! Brett

<%@ Language=VBScript %>

<%
Dim oConn, rs
Dim strConnQuery
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Mode = 1
'Create the path to database
oConn.open session("DSN")
%>

<%
'This page generates the XML data for the Chart contained in
'Default.asp. 

'Database Objects - Initialization
Dim oRs, oRs2, strQuery
'strXML will be used to store the entire XML document generated
Dim strXML

'Create the recordset to retrieve data
Set oRs = Server.CreateObject("ADODB.Recordset")


Function getTotals()
   'Initialize database objects
Dim oRs, strSQL
'Variable to store XML Data
Dim strXML
'To store categories
Dim strCat
'To store amount Dataset & quantity dataset

    Dim strAmtDS, strQtyDS
strCat = "select * from fusion_category"
strSQL = "select * from claim_table where reference_num =" & session("globalrefno")

Set oRs = Server.CreateObject("ADODB.Recordset")
oRs.Open strSQL, oConn

'Initialize <categories> element
strCat = "<categories>"
'Response.Write(strCat)
'Initialize datasets
strIncDS = "<dataset seriesname='Incurred'>"
strPdDS = "<dataset seriesName='Paid' parentYAxis='P'>"

'Variable to store link
Dim strLink 

'Iterate through each data row
Do While not oRs.EOF
strCat = strCat & "<category label='" & oRs("Category") & "'/>"
strIncDS = strIncDS & "<set value='" & oRs("Incurred") & "'/>"
strPdDS = strPdDS & "<set value='" & oRs("Paid") & "'/>"
'oRs.EOF

'Closing elements
strCat = strCat & "</categories>"
strIncDS = strIncDS & "</dataset>"
strPdDS = strPdDS & "</dataset>"

'Entire XML - concatenation
strXML =  strCat & strIncDS & strPdDS

oRs.Close()
Set oRs = nothing

getTotals = strXML

    End Function

strXML = "<chart caption='Incurred vs Paid" & getTotals() & "' xAxisName='Year' palette='" & "' numberPrefix='$' formatNumberScale='0'>"
'Get the data
strXML = strXML & "<set label='Incurred' value='" & getTotals() & "' />"
strXML = strXML & "<set label='Paid' value='" & getTotals() & "' />"
strXML = strXML & "</chart>"

'Output it
Response.ContentType = "text/xml"
Response.Write(strXML)

%>

    

Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>