owc11 connectionstring error with olap - help

A

al

I'm trying to get this knowledgebase example to work but I keep getting error
"The cubename Sales is invalid".
Has anyone been able to get it to work. I'm thinking the connectionstring
is not working. here's the code. change the data source to your server.


<HTML>

<BODY>

<OBJECT ID="PTable" CLASSID="CLSID:0002E552-0000-0000-C000-000000000046"
WIDTH="100%" HEIGHT="60%"><PARAM name="AutoFit" value="False"></PARAM>
</OBJECT>

<P/>

<TABLE WIDTH="100%" HEIGHT="35%">
<TR>
<TD WIDTH="35%" VALIGN="Top">
<SELECT NAME="lstFieldSets" STYLE="width:'100%'">
<OPTION VALUE="1" SELECTED>Time</OPTION>
<OPTION VALUE="2">Store</OPTION>
<OPTION VALUE="3">Product</OPTION>
</SELECT>
<P/>
<BUTTON ID="Button1" STYLE="width:'100%'">List State of All Members
</BUTTON>
<P/>
<BUTTON ID="Button2" STYLE="width:'100%'">List Selected Members Only
</BUTTON>
</TD>
<TD WIDTH="65%">
<TEXTAREA STYLE="width:'100%';height:'100%'" ID=txtResults>
</TEXTAREA>
</TD>
</TR>
</TABLE>

<SCRIPT Language="VBScript">

Dim c 'For PivotTable constants.
Dim oView
Dim sResults
Dim aStates

Function Window_OnLoad()

Set c = PTable.Constants

'Connect to the data source.
PTable.ConnectionString = _
"provider=msolap;data source=devsqlanal;inital catalog=Foodmart 2000;"
PTable.DataMember = "Sales"

Set oView = PTable.ActiveView

'Add Dimensions to the column, row, and filter axes.
oView.ColumnAxis.InsertFieldSet oView.FieldSets("Time")
oView.ColumnAxis.DisplayEmptyMembers = True
oView.RowAxis.InsertFieldSet oView.FieldSets("Store")
oView.RowAxis.DisplayEmptyMembers = True
oView.FilterAxis.InsertFieldSet oView.FieldSets("Product")

'Add a total to the data area.
oView.DataAxis.InsertTotal oView.Totals("Store Sales")
oView.Totals("Store Sales").NumberFormat = "_($* #,##0_)"

aStates = Array("Cleared", "Checked", "Gray")

End Function

Function Button1_OnClick()
Dim oChildren
Dim sFS
sFS = lstFieldsets.options(lstFieldsets.selectedIndex).Text
Set oChildren = PTable.ActiveView.FieldSets(sFS).Member.ChildMembers
sResults = "State of All Members: " & vbCrLf & vbCrLf
For i = 0 To oChildren.Count - 1
Recurse1 oChildren(i), 0
Next
txtResults.innerText = sResults
End Function

Function Recurse1(oPM, nLevel)
Dim oFUpd 'OWC10.PivotFilterUpdate
Set oFUpd = oPM.Field.FieldSet.CreateFilterUpdate
sResults = sResults & aStates(oFUpd.StateOf(oPM)-1) & vbTab & _
Space(nLevel * 3) & "- " & oPM.Name & vbCrLf
For i = 0 To oPM.ChildMembers.Count - 1
Recurse1 oPM.ChildMembers(i), nLevel + 1
Next
End Function

Function Button2_OnClick()
Dim oChildren
Dim sFS
sFS = lstFieldsets.options(lstFieldsets.selectedIndex).Text
Set oChildren = PTable.ActiveView.FieldSets(sFS).Member.ChildMembers
sResults = "Selected Members: " & vbCrLf & vbCrLf
For i = 0 To oChildren.Count - 1
Recurse2 oChildren(i)
Next
txtResults.innerText = sResults
End Function

Function Recurse2(oPM)
Dim oFUpd 'OWC10.PivotFilterUpdate
Dim nState
Set oFUpd = oPM.Field.FieldSet.CreateFilterUpdate
nState = oFUpd.StateOf(oPM)
'If the member is checked, then we can assume that all of
'its child members are also checked and not drill down any further.
If nState = c.plMemberStateChecked Then
sResults = sResults & oPM.UniqueName & vbCrLf
'If the member is gray, check to see which of its child members
'are included.
ElseIf nState = c.plMemberStateGray Then
For i = 0 To oPM.ChildMembers.Count - 1
Recurse2 oPM.ChildMembers(i)
Next
'If the member is cleared, there's no reason to
'drill down any further.
ElseIf nState = c.plMemberStateClear Then
End If
End Function

</SCRIPT>

</HTML>
 
A

al

after days of looking at the code, I finally figured it out. the word
Initial is spelled wrong! My guess is that someone deliberately spelled it
wrong. And this is straight from a Microsoft Knowledgebase article(302101).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top