Page 1 of 1

Process not running in VB

Posted: Sat Sep 01, 2012 12:02 pm
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

Re: Process not running in VB

Posted: Sat Sep 01, 2012 1:14 pm
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