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
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