TM1 TOP API results in excel
Posted: Wed Jan 23, 2013 8:51 am
I am using the below code to fetch the current state of an instance, but want the results to be populated in excel sheet, then can put the code in a loop to get the real time state. As soon as lTemp = TM1TopConnect(lPool, hServer) is executed, TM1 crashes....can you please advise of what I am doing worng here or if there is any other way to get the current status of an instance in Excel through API ?
Public Declare Function TM1TopConnect Lib "tm1api.dll" Alias "_TM1TopConnect@8" (ByVal hPool As Long, ByVal sServerName As Long) As Long
Public Declare Function TM1TopGetCurrentState Lib "tm1api.dll" Alias "_TM1TopGetCurrentState@8" (ByVal hPool As Long, ByVal hServer As Long) As Long
Sub TEST()
Dim hUser As Long
Dim hServer As Long
Dim lPool As Long
Dim lResult As Long
Dim lTemp As Long
Dim lParams As Long
Dim sServer As String
sServer = "GLU-1T"
hUser = getUserHandle()
hServer = getServerHandle(hUser, sServer)
lPool = TM1ValPoolCreate(hUser)
lTemp = TM1TopConnect(lPool, hServer)
End Sub
Public Declare Function TM1TopConnect Lib "tm1api.dll" Alias "_TM1TopConnect@8" (ByVal hPool As Long, ByVal sServerName As Long) As Long
Public Declare Function TM1TopGetCurrentState Lib "tm1api.dll" Alias "_TM1TopGetCurrentState@8" (ByVal hPool As Long, ByVal hServer As Long) As Long
Sub TEST()
Dim hUser As Long
Dim hServer As Long
Dim lPool As Long
Dim lResult As Long
Dim lTemp As Long
Dim lParams As Long
Dim sServer As String
sServer = "GLU-1T"
hUser = getUserHandle()
hServer = getServerHandle(hUser, sServer)
lPool = TM1ValPoolCreate(hUser)
lTemp = TM1TopConnect(lPool, hServer)
End Sub