Process not running in VB

Post Reply
User avatar
roei61
Posts: 41
Joined: Wed Aug 22, 2012 5:44 am
OLAP Product: PAX
Version: 2.0.7
Excel Version: 2016
Location: Israel

Process not running in VB

Post by roei61 »

Hi,

I'm using VB in order to generate integrated login and then to run a process.
The integrated login establish well, but still the process is not running (The VB finish without errors but the TM1 not showing any change in data).
I used the following code for the process:

Code: Select all

Sub RunProc ( hPool As Long, hServer As Long)

Dim hProcess As Long
Dim voProcess As Long
Dim lReturn As Long
Dim hParamArray As Long
Dim voParamArray(0) As Long

voProcess = TM1ValString(hPool, "Save_Data" , 0)
hProcess = TM1ObjectListHandleByNameGet(hPool, hServer, TM1ServerProcesses, voProcess)
voParamArray(0) = TM1ObjectNull()
hParamArray = TM1ValArray(hPool, voParamArray, 0)
lReturn = TM1ProcessExecute(hPool, hProcess, hParamArray)
    
End Sub
What I did wrong? Thanks
Marcus Scherer
Community Contributor
Posts: 126
Joined: Sun Jun 29, 2008 9:33 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2016
Location: Karlsruhe

Re: Process not running in VB

Post by Marcus Scherer »

Hi,
your code is working for me. I didn't test with Integrated login but I need to assume that the hServer handle which is passed from a different routine already did the connect. You should check your hProcess handle against TM1ValTypeError() (see example). Thus you check hServer indirectly. Hope this helps.

Code: Select all

Sub RunProc(hPool As Long, hServer As Long, hUser As Long)
    Dim hProcess As Long
    Dim voProcess As Long
    Dim lReturn As Long
    Dim hParamArray As Long
    Dim voParamArray(0) As Long

    voProcess = TM1ValString(hPool, "Save_Data", 0)
    hProcess = TM1ObjectListHandleByNameGet(hPool, hServer, TM1ServerProcesses, voProcess)
    If TM1ValType(hUser, hProcess) = TM1ValTypeError() Then
        Stop
    End If
    voParamArray(0) = TM1ObjectNull()
    hParamArray = TM1ValArray(hPool, voParamArray, 0)
    Call s_TestHandle(hParamArray, hUser)
    lReturn = TM1ProcessExecute(hPool, hProcess, hParamArray)
    Call s_TestHandle(lReturn, hUser)

End Sub
Post Reply