M
Mark G
I have a web page with an OWC10 Pivot Table and Chart bound to that Pivot
Table. After the user adds the data that they want to the Pivot Table and
adjusts the chart to look the way they want, they save the Pivot Table and
Chartspace definitions (.XMLData property) to the database. I have another
process that periodically grabs these Pivot Table and Chartspace definitions
and tries to recreate them on the server side in an ASP page in order to
spit out a chart image using the ExportPicture function of the Chartspace
object. My problem is that I cannot get the charts to display any data.
I'm not sure whether it is the Pivot Table unable to retrieve data from the
Analysis Services cube or if it is a problem with the linkage between the
Pivot Table and Chartspace.
Does anyone have any ideas?
Here is a snippet of the code:
Dim ptable, cspace, sFileName
Dim c
Dim rs, Conn
Dim dsc
'********** set up pivot table **************
Set ptable = CreateObject("OWC10.PivotTable")
ptable.ConnectionString = "Provider=MSOLAP.2; Persist Security Info=True;
Data Source=MyOLAPServer; Initial Catalog=Foodmart 2000;"
'*********** set up chart space **************
Set cspace = CreateObject("OWC10.Chartspace")
cspace.datasource = ptable
Set c = cspace.Constants
Set Conn = CreateObject("ADODB.Connection")
Conn.Open "provider=microsoft.jet.oledb.4.0;data source=c:\Reports.mdb"
'** get list of PivotTable/Chartspace definitions stored in the database
Set rs = Conn.Execute("SELECT SnapshotID, CubeName, ReportDef, ChartDef
FROM Snapshots where cubename='Sales' ORDER BY CubeName")
Do While Not rs.EOF
ptable.XMLData = rs.Fields("ReportDef")
ptable.DataMember = rs.Fields("CubeName")
cspace.XMLData = rs.Fields("ChartDef")
cspace.PlotAllAggregates = c.chPlotAggregatesSeries '***** this
occasionally throws an error indicating that the "external data source
failed to connect." Even if I don't get an error here, I still get an empty
chart with no data.
sFileName = rs.Fields("CubeName") & "_" & rs.Fields("SnapshotID") &
".gif"
'************* save chart to file *****************
ExportChart cspace, "gif", 300, 400, sFileName '** this function calls
the ExportPicture function of the chartspace object
rs.MoveNext
Loop
TIA,
Mark
Table. After the user adds the data that they want to the Pivot Table and
adjusts the chart to look the way they want, they save the Pivot Table and
Chartspace definitions (.XMLData property) to the database. I have another
process that periodically grabs these Pivot Table and Chartspace definitions
and tries to recreate them on the server side in an ASP page in order to
spit out a chart image using the ExportPicture function of the Chartspace
object. My problem is that I cannot get the charts to display any data.
I'm not sure whether it is the Pivot Table unable to retrieve data from the
Analysis Services cube or if it is a problem with the linkage between the
Pivot Table and Chartspace.
Does anyone have any ideas?
Here is a snippet of the code:
Dim ptable, cspace, sFileName
Dim c
Dim rs, Conn
Dim dsc
'********** set up pivot table **************
Set ptable = CreateObject("OWC10.PivotTable")
ptable.ConnectionString = "Provider=MSOLAP.2; Persist Security Info=True;
Data Source=MyOLAPServer; Initial Catalog=Foodmart 2000;"
'*********** set up chart space **************
Set cspace = CreateObject("OWC10.Chartspace")
cspace.datasource = ptable
Set c = cspace.Constants
Set Conn = CreateObject("ADODB.Connection")
Conn.Open "provider=microsoft.jet.oledb.4.0;data source=c:\Reports.mdb"
'** get list of PivotTable/Chartspace definitions stored in the database
Set rs = Conn.Execute("SELECT SnapshotID, CubeName, ReportDef, ChartDef
FROM Snapshots where cubename='Sales' ORDER BY CubeName")
Do While Not rs.EOF
ptable.XMLData = rs.Fields("ReportDef")
ptable.DataMember = rs.Fields("CubeName")
cspace.XMLData = rs.Fields("ChartDef")
cspace.PlotAllAggregates = c.chPlotAggregatesSeries '***** this
occasionally throws an error indicating that the "external data source
failed to connect." Even if I don't get an error here, I still get an empty
chart with no data.
sFileName = rs.Fields("CubeName") & "_" & rs.Fields("SnapshotID") &
".gif"
'************* save chart to file *****************
ExportChart cspace, "gif", 300, 400, sFileName '** this function calls
the ExportPicture function of the chartspace object
rs.MoveNext
Loop
TIA,
Mark