Dear cognos forum members,
by trying to add a special category using a macro code I get the error message R440 "AutoExe: (Type) : Wrong argument value. Does anyone now more about this error message and what I have to do?
The macro code is an example based on the Great outdoor Company mdl. The error rises in line after 'create a special category commentary.
code:
Sub Main()
Dim objTransApp As Object
Dim objModel As Object
Dim objCat1 As Object
Dim objCat2 As Object
Dim objSpecCategory As Object
Dim strModelPath As String
Dim strLocation As String
Dim strModelSource As String
strLocation = "C:\Program Files\Cognos\Cer2\Samples\PowerPlay"
strModelSource = "\Cubes and Reports\Great Outdoors Company.mdl"
strModelPath = strLocation & strModelSource
Set objTransApp = CreateObject("CognosTransformer.Application"
Set objModel = objTransApp.OpenModel (strModelPath)
'Create a special category in a non-time dimension.
Set objSpecCategory = objModel.Dimensions("Products".Categories.Add(trSpecialCategory)
With objSpecCategory
.Code = "MySpCategoryCode"
.Name = "MySpCategoryName"
.update
End With
'Grab the 2 regular categories that we want under the special category
Set objCat1 = objModel.Dimensions("SourceDimName".DrillDowns(1).Categories(5)
'Print objCat1.Code & " " & objCat1.Label 'Debug Print to check that we got the right category
Set objCat2 = objModel.Dimensions("SourceDimName".DrillDowns(1).Categories(4)
'Print objCat2.Code & " " & objCat2.Label 'Debug Print to check that we got the right category
'Associate 2 regular categories with the new special category
objSpecCategory.ConnectWithCategory objCat1
objSpecCategory.ConnectWithCategory objCat2
objSpecCategory.Update
With objModel
.SaveAs strLocation & _
"\Cubes and Reports\Great Outdoors CompanyX.mdl"
.Close
End With
Set objSpecCategory = Nothing
Set objModel = Nothing
Set objTransApp = Nothing
End Sub
regards,
AmAc
by trying to add a special category using a macro code I get the error message R440 "AutoExe: (Type) : Wrong argument value. Does anyone now more about this error message and what I have to do?
The macro code is an example based on the Great outdoor Company mdl. The error rises in line after 'create a special category commentary.
code:
Sub Main()
Dim objTransApp As Object
Dim objModel As Object
Dim objCat1 As Object
Dim objCat2 As Object
Dim objSpecCategory As Object
Dim strModelPath As String
Dim strLocation As String
Dim strModelSource As String
strLocation = "C:\Program Files\Cognos\Cer2\Samples\PowerPlay"
strModelSource = "\Cubes and Reports\Great Outdoors Company.mdl"
strModelPath = strLocation & strModelSource
Set objTransApp = CreateObject("CognosTransformer.Application"
Set objModel = objTransApp.OpenModel (strModelPath)
'Create a special category in a non-time dimension.
Set objSpecCategory = objModel.Dimensions("Products".Categories.Add(trSpecialCategory)
With objSpecCategory
.Code = "MySpCategoryCode"
.Name = "MySpCategoryName"
.update
End With
'Grab the 2 regular categories that we want under the special category
Set objCat1 = objModel.Dimensions("SourceDimName".DrillDowns(1).Categories(5)
'Print objCat1.Code & " " & objCat1.Label 'Debug Print to check that we got the right category
Set objCat2 = objModel.Dimensions("SourceDimName".DrillDowns(1).Categories(4)
'Print objCat2.Code & " " & objCat2.Label 'Debug Print to check that we got the right category
'Associate 2 regular categories with the new special category
objSpecCategory.ConnectWithCategory objCat1
objSpecCategory.ConnectWithCategory objCat2
objSpecCategory.Update
With objModel
.SaveAs strLocation & _
"\Cubes and Reports\Great Outdoors CompanyX.mdl"
.Close
End With
Set objSpecCategory = Nothing
Set objModel = Nothing
Set objTransApp = Nothing
End Sub
regards,
AmAc