T
TJCube
Hi All
I have just started converting my classic ASP web pages for office web
components to .net. I found this wonderful article on the MS site entitled
"Build an OLAP Reporting App in ASP.NET using SQL Server 2000 Analysis
Services and Office XP. I have created a project in .Net and everything works
fine .. EXCEPT for one thing.
I am getting the following error message "Interop.Owc10 - Unspecified error"
when accessing some of the properties and methods of the OWC10.dll class. I
have been searching for a solution on the net and I am hoping that this forum
can help. Below is the sample code for the LoadCustomPivotTableReport
WebMethod provided with the above article. Everything works fine until the
line starting 'define the column elements'. I am getting the same error if I
convert the code to c#.
<WebMethod()> Public Function LoadCustomPivotTableReport(ByVal _
strCity1 As String, ByVal strCity2 As String) As String
Dim m_XML As String
Dim strOLAPConn As String =
ConfigurationSettings.AppSettings("OLAPConnectionString")
Dim objPT As PivotTableClass = New PivotTableClass
Dim objPTView As PivotView
Dim fldCity, fldName, fldProdFamily As PivotField
Dim fSetCustomers, fSetProduct As PivotFieldSet
Try
' set the connection string and data member
objPT.ConnectionString = strOLAPConn
objPT.DataMember = "Sales"
'objPT.AllowPropertyToolbox = False
objPT.AllowFiltering = False
objPTView = objPT.ActiveView
objPTView.TitleBar.Caption = "City Comparison of Drink Sales"
' define the column elements
objPTView.ColumnAxis.InsertFieldSet(objPTView.FieldSets("Time"))
objPTView.ColumnAxis.FieldSets("Time").Fields("Year").Expanded =
True
' define the row elements
fSetCustomers = objPTView.FieldSets("Customers")
objPTView.RowAxis.InsertFieldSet(fSetCustomers)
fSetCustomers.Fields("Country").IsIncluded = False
fSetCustomers.Fields("State Province").IsIncluded = False
fSetCustomers.Fields("Name").IsIncluded = False
' define the members of the row elements
fldCity = fSetCustomers.Fields("City")
fldCity.IncludedMembers = New Object() {strCity1, strCity2}
' exclude all other field row members in the fieldset
fSetProduct = objPTView.FieldSets("Product")
objPTView.RowAxis.InsertFieldSet(fSetProduct)
fSetProduct.Fields("Product Department").IsIncluded = False
fSetProduct.Fields("Product Category").IsIncluded = False
fSetProduct.Fields("Product Subcategory").IsIncluded = False
fSetProduct.Fields("Brand Name").IsIncluded = False
fSetProduct.Fields("Product Name").IsIncluded = False
'fldProdFamily = fSetProduct.Fields("Product Family")
fldProdFamily.IncludedMembers = "Drink"
' define the measures
objPTView.DataAxis.InsertTotal(objPTView.Totals("Unit Sales"))
objPTView.DataAxis.InsertTotal(objPTView.Totals("Store Sales"))
objPTView.DataAxis.Totals("Store Sales").NumberFormat = "Currency"
Dim ChartSpace1 As ChartSpaceClass = New ChartSpaceClass
ChartSpace1.Charts(0).Type() = ChartChartTypeEnum.chChartTypeBar3D
m_XML = objPT.XMLData
objPT = Nothing
Catch err As Exception
m_XML = "<err>" & err.Source & " - " & err.Message & "</err>"
Finally
End Try
Return (m_XML)
End Function
I have just started converting my classic ASP web pages for office web
components to .net. I found this wonderful article on the MS site entitled
"Build an OLAP Reporting App in ASP.NET using SQL Server 2000 Analysis
Services and Office XP. I have created a project in .Net and everything works
fine .. EXCEPT for one thing.
I am getting the following error message "Interop.Owc10 - Unspecified error"
when accessing some of the properties and methods of the OWC10.dll class. I
have been searching for a solution on the net and I am hoping that this forum
can help. Below is the sample code for the LoadCustomPivotTableReport
WebMethod provided with the above article. Everything works fine until the
line starting 'define the column elements'. I am getting the same error if I
convert the code to c#.
<WebMethod()> Public Function LoadCustomPivotTableReport(ByVal _
strCity1 As String, ByVal strCity2 As String) As String
Dim m_XML As String
Dim strOLAPConn As String =
ConfigurationSettings.AppSettings("OLAPConnectionString")
Dim objPT As PivotTableClass = New PivotTableClass
Dim objPTView As PivotView
Dim fldCity, fldName, fldProdFamily As PivotField
Dim fSetCustomers, fSetProduct As PivotFieldSet
Try
' set the connection string and data member
objPT.ConnectionString = strOLAPConn
objPT.DataMember = "Sales"
'objPT.AllowPropertyToolbox = False
objPT.AllowFiltering = False
objPTView = objPT.ActiveView
objPTView.TitleBar.Caption = "City Comparison of Drink Sales"
' define the column elements
objPTView.ColumnAxis.InsertFieldSet(objPTView.FieldSets("Time"))
objPTView.ColumnAxis.FieldSets("Time").Fields("Year").Expanded =
True
' define the row elements
fSetCustomers = objPTView.FieldSets("Customers")
objPTView.RowAxis.InsertFieldSet(fSetCustomers)
fSetCustomers.Fields("Country").IsIncluded = False
fSetCustomers.Fields("State Province").IsIncluded = False
fSetCustomers.Fields("Name").IsIncluded = False
' define the members of the row elements
fldCity = fSetCustomers.Fields("City")
fldCity.IncludedMembers = New Object() {strCity1, strCity2}
' exclude all other field row members in the fieldset
fSetProduct = objPTView.FieldSets("Product")
objPTView.RowAxis.InsertFieldSet(fSetProduct)
fSetProduct.Fields("Product Department").IsIncluded = False
fSetProduct.Fields("Product Category").IsIncluded = False
fSetProduct.Fields("Product Subcategory").IsIncluded = False
fSetProduct.Fields("Brand Name").IsIncluded = False
fSetProduct.Fields("Product Name").IsIncluded = False
'fldProdFamily = fSetProduct.Fields("Product Family")
fldProdFamily.IncludedMembers = "Drink"
' define the measures
objPTView.DataAxis.InsertTotal(objPTView.Totals("Unit Sales"))
objPTView.DataAxis.InsertTotal(objPTView.Totals("Store Sales"))
objPTView.DataAxis.Totals("Store Sales").NumberFormat = "Currency"
Dim ChartSpace1 As ChartSpaceClass = New ChartSpaceClass
ChartSpace1.Charts(0).Type() = ChartChartTypeEnum.chChartTypeBar3D
m_XML = objPT.XMLData
objPT = Nothing
Catch err As Exception
m_XML = "<err>" & err.Source & " - " & err.Message & "</err>"
Finally
End Try
Return (m_XML)
End Function