Adding a measure to the OLAP-Cube. Still problems, but more information!

S

Schlamper

Hi All,

thanks for your replies.But I am still unable to add the measure to
the cube. I suppose, a dso-object based on a virtual cube, behaves the
same as the object based on a "real" cube.

Maybe I am wrong ?
Is there another stupid mistake in my code ?

So here is the code:

Dim dsoServer As New DSO.Server
Dim dsoDB As DSO.MDStore
Dim dsoCube As DSO.MDStore
Dim dsoMea As DSO.Measure
Dim dsoAssFactCube As DSO.Cube
Dim dsoPortAnalyzerCube As DSO.Cube

'Mit dem Server verbinden
dsoServer.Connect sServerName

'Prüfen, ob alle benötigten Komponenten vorhanden sind
If dsoServer.MDStores.Find(sCubeName) = False Then

GoTo err_no_database

End If

'Mit der Datenbank verbinden
Set dsoDB = dsoServer.MDStores(sCubeName)

If dsoDB.DataSources.Count = 0 Then

GoTo err_no_datasource

ElseIf dsoDB.Dimensions.Count = 0 Then

GoTo err_no_dimensions

ElseIf dsoDB.MDStores.Find("MSP_ASSN_FACT") = False Then

GoTo err_no_fact_cube

ElseIf dsoDB.MDStores.Find("MSP_PORTFOLIO_ANALYZER") = False Then

GoTo err_no_analyzer

End If

'Die Variablen auf die Cubes setzen
Set dsoAssFactCube = dsoDB.MDStores("MSP_ASSN_FACT")
Set dsoPortAnalyzerCube = dsoDB.MDStores("MSP_PORTFOLIO_ANALYZER")

Set dsoMea = dsoAssFactCube.Measures.AddNew("Fixed Cost")
dsoMea.SourceColumn = """MSP_CUBE_ASSN_FACT"".""ASSN_FIXED_COST"""
dsoMea.SourceColumnType = ADODB.DataTypeEnum.adDecimal 'The data
type for the column
dsoMea.AggregateFunction = aggSum 'The method for the column
'aggSum aggregates the column by summation.

dsoAssFactCube.Update
dsoAssFactCube.Process

Set dsoMea = dsoPortAnalyzerCube.Measures.AddNew("Fixed Cost")
tsLog.WriteLine ("Executed addnew!")
dsoMea.SourceColumn = """MSP_ASSN_FACT"".""FIXED COST"""

'From here on I run in trouble. The next statement raises an error
with the description:
'(445) Object doesn't support this action

dsoMea.SourceColumnType = ADODB.DataTypeEnum.adDecimal 'The data
type for the column

dsoMea.AggregateFunction = aggSum 'The method for the column
'aggSum aggregates the column by summation.


dsoPortAnalyzerCube.Update

dsoPortAnalyzerCube.Process

dsoDB.Process

leave_now:
UserOLAPUpdate = 0
Exit Function

err_no_database:

l_errnum = 1
s_errdesc = "Datenbank konnte nicht gefunden werden!"



UserOLAPUpdate = vbObjectError + 1

Exit Function

err_no_datasource:

l_errnum = 1
s_errdesc = "Datenquelle konnte nicht gefunden werden!"

UserOLAPUpdate = vbObjectError + 2

Exit Function

err_no_dimensions:

l_errnum = 1
s_errdesc = "Dimensionen konnten nicht gefunden werden!"

UserOLAPUpdate = vbObjectError + 3

Exit Function

err_no_fact_cube:

l_errnum = 1
s_errdesc = "Cube MSP_ASSN_FACT konnte nicht gefunden werden!"

UserOLAPUpdate = vbObjectError + 4

Exit Function

err_no_analyzer:

l_errnum = 1
s_errdesc = "Cube MSP_PORTFOLIO_ANALYZER konnte nicht gefunden
werden!"

UserOLAPUpdate = vbObjectError + 5

Exit Function

error_handler:

l_errnum = Err.Number
s_errdesc = Err.Description

UserOLAPUpdate = 1 ' although it could be any non-zero value
' to indicate an error


Regards and thanks for any help

Wolfgang
 
H

Hugues Perron

Hi Wolfgang,

I have some problems with my computer and cannot completly debug your code
but I can give you some hnts.

1- when you create the measure in the second cube (dsoPortAnalyzerCube),
it`s a virtual cube, so you don`t need to set the column type neither the
aggregate function.
2- You need to use another variable for the measure (as for example use
dsoMea2).

As soon as I get a new OS, I will try to completely debug it.

Hope this helps !!!

Hugues
 
S

Schlamper

Hi All,

today I found the mistake. Yes, there is a difference between an
object of a virtual and a real cube.
After I changed my code as follows, everything works fine:

Dim dsoServer As New DSO.Server
Dim dsoDB As DSO.MDStore
Dim dsoCube As DSO.MDStore
Dim dsoMea As DSO.Measure
Dim dsoAssFactCube As DSO.Cube
Dim dsoPortAnalyzerCube As DSO.Cube

'Mit dem Server verbinden
dsoServer.Connect sServerName

'Prüfen, ob alle benötigten Komponenten vorhanden sind
If dsoServer.MDStores.Find(sCubeName) = False Then

GoTo err_no_database

End If

'Mit der Datenbank verbinden
Set dsoDB = dsoServer.MDStores(sCubeName)

If dsoDB.DataSources.Count = 0 Then

GoTo err_no_datasource

ElseIf dsoDB.Dimensions.Count = 0 Then

GoTo err_no_dimensions

ElseIf dsoDB.MDStores.Find("MSP_ASSN_FACT") = False Then

GoTo err_no_fact_cube

ElseIf dsoDB.MDStores.Find("MSP_PORTFOLIO_ANALYZER") = False Then

GoTo err_no_analyzer

End If

'Die Variablen auf die Cubes setzen
Set dsoAssFactCube = dsoDB.MDStores("MSP_ASSN_FACT")
Set dsoPortAnalyzerCube = dsoDB.MDStores("MSP_PORTFOLIO_ANALYZER")

Set dsoMea = dsoAssFactCube.Measures.AddNew("Fixed Cost")
dsoMea.SourceColumn = """MSP_CUBE_ASSN_FACT"".""ASSN_FIXED_COST"""
dsoMea.SourceColumnType = ADODB.DataTypeEnum.adDecimal 'The data
type for the column
dsoMea.AggregateFunction = aggSum 'The method for the column
aggSum aggregates the column by summation.

dsoAssFactCube.Update
dsoAssFactCube.Process

'dsoAnalyzerCube repräsentiert einen virtuellen Cube. Da die
measure eines virtuellen Cubes einen Teil
'ihrer Eigenschaften von der zu Grunde liegenden measure des
realen cubes "erbt", brauch (kann) nur die
'SourceColumn-Eigenschaft gesetzt zu werden.
Set dsoMea = dsoPortAnalyzerCube.Measures.AddNew("Fixed Cost")

'Die Spalte wird in "normaler" Form angegeben, da die measure zu
einem virtuellen Cube gehört!
dsoMea.SourceColumn = "MSP_ASSN_FACT.FIXED COST"

dsoPortAnalyzerCube.Update
dsoPortAnalyzerCube.Process

dsoDB.Process

leave_now:
UserOLAPUpdate = 0
Exit Function

err_no_database:

l_errnum = 1
s_errdesc = "Datenbank konnte nicht gefunden werden!"

UserOLAPUpdate = vbObjectError + 1

Exit Function

err_no_datasource:

l_errnum = 1
s_errdesc = "Datenquelle konnte nicht gefunden werden!"

UserOLAPUpdate = vbObjectError + 2

Exit Function

err_no_dimensions:

l_errnum = 1
s_errdesc = "Dimensionen konnten nicht gefunden werden!"

UserOLAPUpdate = vbObjectError + 3

Exit Function

err_no_fact_cube:

l_errnum = 1
s_errdesc = "Cube MSP_ASSN_FACT konnte nicht gefunden werden!"

UserOLAPUpdate = vbObjectError + 4

Exit Function

err_no_analyzer:

l_errnum = 1
s_errdesc = "Cube MSP_PORTFOLIO_ANALYZER konnte nicht gefunden
werden!"

UserOLAPUpdate = vbObjectError + 5

Exit Function

error_handler:

l_errnum = Err.Number
s_errdesc = Err.Description

UserOLAPUpdate = 1 ' although it could be any non-zero value
' to indicate an error
 
B

Bashar Adas

Hi
i am currently facing the same problem
but some body gave me a tip and here it is.
Go to Google and search for "OlapExtensions.exe" then
download it from microsofts site then see the code.
I hope i am not repeating something that you already know.

Wish you all the best
-----Original Message-----
Hi All,

thanks for your replies.But I am still unable to add the measure to
the cube. I suppose, a dso-object based on a virtual cube, behaves the
same as the object based on a "real" cube.

Maybe I am wrong ?
Is there another stupid mistake in my code ?

So here is the code:

Dim dsoServer As New DSO.Server
Dim dsoDB As DSO.MDStore
Dim dsoCube As DSO.MDStore
Dim dsoMea As DSO.Measure
Dim dsoAssFactCube As DSO.Cube
Dim dsoPortAnalyzerCube As DSO.Cube

'Mit dem Server verbinden
dsoServer.Connect sServerName

'Prüfen, ob alle benötigten Komponenten vorhanden sind
If dsoServer.MDStores.Find(sCubeName) = False Then

GoTo err_no_database

End If

'Mit der Datenbank verbinden
Set dsoDB = dsoServer.MDStores(sCubeName)

If dsoDB.DataSources.Count = 0 Then

GoTo err_no_datasource

ElseIf dsoDB.Dimensions.Count = 0 Then

GoTo err_no_dimensions

ElseIf dsoDB.MDStores.Find("MSP_ASSN_FACT") = False Then

GoTo err_no_fact_cube

ElseIf dsoDB.MDStores.Find("MSP_PORTFOLIO_ANALYZER") = False Then

GoTo err_no_analyzer

End If

'Die Variablen auf die Cubes setzen
Set dsoAssFactCube = dsoDB.MDStores("MSP_ASSN_FACT")
Set dsoPortAnalyzerCube = dsoDB.MDStores ("MSP_PORTFOLIO_ANALYZER")

Set dsoMea = dsoAssFactCube.Measures.AddNew("Fixed Cost")
dsoMea.SourceColumn
= """MSP_CUBE_ASSN_FACT"".""ASSN_FIXED_COST"""
dsoMea.SourceColumnType =
ADODB.DataTypeEnum.adDecimal 'The data
type for the column
dsoMea.AggregateFunction = aggSum 'The method for the column
'aggSum aggregates the column by summation.

dsoAssFactCube.Update
dsoAssFactCube.Process

Set dsoMea = dsoPortAnalyzerCube.Measures.AddNew ("Fixed Cost")
tsLog.WriteLine ("Executed addnew!")
dsoMea.SourceColumn = """MSP_ASSN_FACT"".""FIXED COST"""

'From here on I run in trouble. The next statement raises an error
with the description:
'(445) Object doesn't support this action

dsoMea.SourceColumnType =
ADODB.DataTypeEnum.adDecimal 'The data
 

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

Similar Threads


Top