Re: Create a chart object in LotusScript ?



I come back here for another problem (one more sorry), i follow your
advices and use intensively the msdn reference to work but i am
discouraged...

I "translate" a vbscript script which is working very well to
lotusscript (which are very similar)
the vbscript's one worked pretty good but not the lotusscript one,
datas are good, there are not the problem.

but in html page the office component launch but the charts are not
builded (image to illustrate this :
http://pix.nofrag.com/09/9b/2662a36b515451f08b354d3b6e50.html at left
the lotusscript at right the vbscript)

here is the code :

VB :

Sub Initialize
On Error Goto erreur

Dim strCat As String
Dim strVal As String

Set s = New notessession
Set db = s.CurrentDatabase
Set contextDoc = s.DocumentContext
docUNID = getQueryVal(contextDoc.Query_String_Decoded(0),"docUNID")
Set queryDoc = db.GetDocumentByUNID(docUNID)

strVal = "Array("
For i=0 To Ubound(queryDoc.Expr2 )
strVal = strVal +|"|+Format$(queryDoc.Expr2(i))+|",|
Next
strVal = Left$(strVal,Len(strVal)-1)
strVal = strVal +")"

strCat = "Array("
For i=0 To Ubound(queryDoc.Expr2 )
strCat = strCat +|"|+Format$(queryDoc.COUNTRY_NAME(i))+|",|
Next
strCat = Left$(strCat,Len(strCat)-1)
strCat = strCat +")"

Print |<html>|
Print |<body>|
Print |<object classid="clsid:0002E556-0000-0000-C000-000000000046"
id="ChartSpace1" style="width:100%;"></object>|
Print |</body>|
Print |<script language="vbscript">|
Print |Function Window_OnLoad()|
Print |Set c = ChartSpace1.Constants|
Print |Set oCht = ChartSpace1.Charts.Add|
Print |Set oSer = oCht.SeriesCollection.Add|
Print |oSer.SetData c.chDimCategories, -1, |+strCat+||
Print |oSer.SetData c.chDimValues, -1, |+strVal+||
Print |oSer.Interior.Color = "green"|
Print |End Function|
Print |</script>|
Print |</html>|

Exit Sub

erreur:
Print Cstr(Err) + " : " + Error$ + " at line " + Cstr(Erl)
Exit Sub
End Sub


And the LS :

Sub Initialize
On Error Goto erreur

Dim login As String
Dim password As String
Dim UDLPath As String

Set s = New notessession
Set db = s.CurrentDatabase
Set contextDoc = s.DocumentContext
docUNID = getQueryVal(contextDoc.Query_String_Decoded(0),"docUNID")
Set queryDoc = db.GetDocumentByUNID(docUNID)

originQuery = queryDoc.qQuery(0)
SQLQuery = queryDoc.inWorkQuery(0)

If SQLQuery="" Then
SQLQuery = originQuery
End If

login = queryDoc.qLogin(0)
password = queryDoc.qPassword(0)
UDLPath = queryDoc.qUDLPath(0)
orderBy = queryDoc.orderBy(0)
sortBy = queryDoc.sortBy(0)

Set cn = CreateObject("adodb.connection")
Call cn.open("File Name="+UDLPath+"",login,password)
Set Result = CreateObject("ADODB.Recordset")
Result.Open SQLQuery, cn

Dim strCat As Variant
Dim strVal As Variant

strCat = queryDoc.COUNTRY_NAME
strVal = queryDoc.Expr2

Dim ChartSpace1,c,cht,sc
Set ChartSpace1 = CreateObject("OWC11.ChartSpace")
With ChartSpace1
Set c = .Constants
Set cht = .Charts.Add()
cht.Type = c.chChartTypeColumnClustered

cht.SetData c.chDimSeriesNames, c.chDataLiteral, "test"
cht.SetData c.chDimCategories,c.chDataLiteral, strCat
cht.SeriesCollection(0).SetData c.chDimValues,c.chDataLiteral,
strVal
End With

Print {Content-Type:text/html}
Print |<html>|
Print |<head>|
Print |<title>|+queryDoc.qTitle(0)+|</title>|
Print |<body>|
Print |<object classid="clsid:0002E556-0000-0000-C000-000000000046"
id="ChartSpace1" style="width:100%;"></object>|
Print |</body>|
Print |</html>|

Exit Sub

erreur:
Print Cstr(Err) + " : " + Error$ + " at line " + Cstr(Erl)
Exit Sub
End Sub


Where is the problem ??? i m desperate... thanks for helping

.