Servers Crashs When Trying To Create a Subset using VBA
Posted: Thu Sep 09, 2010 3:01 pm
Hello,
I am trying to create subset using the TM1 API but when I try and register the object the servers crashes. Any ideas on how to fix this would be welcomed.
Thanks
Martyn
Function CreateSubset()
Dim hpool As Long, hserver As Long, SSCreate, SSInsertEle As Long, SSObj, DimObj, RegObj As Long
Const FIXED_STR_LENGTH = 100
Dim sErr As String * FIXED_STR_LENGTH
hUser = TM1_API2HAN()
hserver = TM1SystemServerHandle(hUser, "train")
hpool = TM1ValPoolCreate(hUser)
DimObj = TM1ObjectListHandleByNameGet(hpool, hserver, TM1ServerDimensions(), TM1ValString(hpool, "region", 0))
SSCreate = TM1SubsetCreateEmpty(hpool, DimObj)
SSInsertEle = TM1SubsetAll(hpool, SSCreate)
If TM1ValType(hUser, SSInsertEle) = TM1ValTypeError() Then
Call TM1ValErrorString_VB(hUser, SSInsertEle, sErr, FIXED_STR_LENGTH)
MsgBox sErr
End If
RegObj = TM1ObjectRegister(hpool, hserver, SSCreate, TM1ValString(hpool, "test1", 0))
End Function
I am trying to create subset using the TM1 API but when I try and register the object the servers crashes. Any ideas on how to fix this would be welcomed.
Thanks
Martyn
Function CreateSubset()
Dim hpool As Long, hserver As Long, SSCreate, SSInsertEle As Long, SSObj, DimObj, RegObj As Long
Const FIXED_STR_LENGTH = 100
Dim sErr As String * FIXED_STR_LENGTH
hUser = TM1_API2HAN()
hserver = TM1SystemServerHandle(hUser, "train")
hpool = TM1ValPoolCreate(hUser)
DimObj = TM1ObjectListHandleByNameGet(hpool, hserver, TM1ServerDimensions(), TM1ValString(hpool, "region", 0))
SSCreate = TM1SubsetCreateEmpty(hpool, DimObj)
SSInsertEle = TM1SubsetAll(hpool, SSCreate)
If TM1ValType(hUser, SSInsertEle) = TM1ValTypeError() Then
Call TM1ValErrorString_VB(hUser, SSInsertEle, sErr, FIXED_STR_LENGTH)
MsgBox sErr
End If
RegObj = TM1ObjectRegister(hpool, hserver, SSCreate, TM1ValString(hpool, "test1", 0))
End Function