Connect to an OLAP cube via SERVER-SIDE scripting using Pivot Table Web Component

Connect to an OLAP cube via SERVER-SIDE scripting using Pivot Table Web Component

Post by Felix Kand » Sat, 21 Dec 2002 07:18:32



Hi!

I am not very familiar with programming web solutions for MS OLAP
Databases.
Currently I try to use the Pivot Table Service of MS Office Web
Components 10 (XP) in server-side scripting.

MS provides a small demo how to compile a pivot table in the server's
memory and then send it to the usa in pure HTML.

They use the Northwind Demo Database. Yet I tried to translate this
Demo to connect to a multidimensional OLAP cube ("Sales" from
"FoodMart 2000").

Below I pasted the error I get as well as the ASP script.
Can anyone out there help me to access the OLAP cube?

Greatest Thanks,
Felix

----------------------------------------------------------------------------
"Kompilierungsfehler in Microsoft VBScript- Fehler '800a03ea'

Syntaxfehler

/iisHelp/common/500-100.asp, line 122

on error go to 0
---------^
Microsoft? OLE DB Provider fr Analysis Services- Fehler '80004005'

Datenbank 'FoodMart 2000' ist nicht vorhanden.

/Server Side X.asp, line 33 "
-------------------------------------------------------------------------

... which means: "Database 'FoodMart 2000' not available/existing"

The ASP code is:

--------------------------------------------------------------------------

<%
        '  
    'Create an in-memory reference to the PivotTable component.
    '

    Dim oPivot
    Set oPivot = Server.CreateObject("OWC10.PivotTable")

        '
    'Connect to the OLAP FoodMart 2000 database.
    '

    oPivot.CubeProvider = "msolap.2"
    oPivot.ConnectionString = "provider=MSOLAP.2;Data
Source=localhost;Initial Catalog=FoodMart 2000;Integrated
Security=SSPI;Persist Security Info=True;Client Cache Size=25;Auto
Synch Period=10000;"
    oPivot.DataMember="Sales"

        '
    'Add fields to the row axis and column axis for grouping.
        '

    Dim oView
    Set oView = oPivot.ActiveView

    Dim oDim1Fields
    Set oDim1Fields = oView.FieldSets("Time")
    oDim1Fields.Fields(0).Caption = "Time"
    oView.RowAxis.InsertFieldSet oDim1Fields

    Dim oDim2Fields
    Set oDim2Fields = oView.FieldSets("Gender")
    oView.ColumnAxis.InsertFieldSet oDim2Fields
    oTimeFields.Fields(0).Caption = "Gender"

        '
    'Add a total for the ProductSales fieldset.
    '

    oView.DataAxis.InsertTotal oView.AddTotal("Unit Sales",
oView.FieldSets("Unit Sales").Fields(0),
oPivot.Constants.plFunctionSum)
    oView.Totals("Unit Sales").NumberFormat = "$#,##0"

        '
    'Collapse rows and columns.
    '

    oView.ExpandDetails = oPivot.Constants.plExpandNever

    '
    'Send Data as HTML.
    '

    Response.Write oPivot.HTMLData

%>
--------------------------------------------------------------------------