Names of Cubes in a server
Posted: Mon Feb 01, 2010 7:50 pm
I'm totally deseperate because I've been working on this for a week and I can't see the mistake or fix this code, if some could help me I'll be so thankful.
I'm trying to get the names of the cubes in a server and I having a problem with the last function:
Call TM1ValStringGet_VB(hUser, hName, name, 75)
I am using the same process before to get the name of a server and I don't have any problem, but I don't know why for the names of the cubes, that it should be the name, it doesn't works.
Thank you very much in advance to everyone for your help
I'm trying to get the names of the cubes in a server and I having a problem with the last function:
Call TM1ValStringGet_VB(hUser, hName, name, 75)
I am using the same process before to get the name of a server and I don't have any problem, but I don't know why for the names of the cubes, that it should be the name, it doesn't works.
Code: Select all
'Connect to the server
hPool = TM1ValPoolCreate(hUser)
hPool2 = TM1ValPoolCreate(hUser)
hServer = TM1SystemServerConnect(hPool, vServerName, vUserName, vPassword)
'Return the name of the server: It's works
vsServerName = TM1ObjectPropertyGet(hPool2, hServer, TM1ObjectName())
Call TM1ValStringGet_VB(hUser, vsServerName, sServerName, 75)
'Retrieve a count of the number of cubes defined in the server-
Dim hCount As Long
hCount = TM1ObjectListCountGet(hPool, hServer, TM1ServerCubes)
'Convert the count to something you can use-
Dim countOfCubes As Long
countOfCubes = TM1ValIndexGet(hUser, hCount)
'Loop around retrieving each cube object from the server, until index = countOfCubes-
Dim hCube As Long
Dim index As Long
index = 2
hCube = TM1ObjectListHandleByIndexGet(hPool, vServerName, TM1ServerCubes(), index)
'Retrieve the name of the cube using the TM1ObjectName property-
hName = TM1ObjectPropertyGet(hPool, hCube, TM1ObjectName())
'Convert the cube name to a string-
Dim name As String * 75
'When I try to execute this Sub, Excel give me a fatal error and Excel closes.
Call TM1ValStringGet_VB(hUser, hName, name, 75)