TM1 API Process Call with Parameters
Posted: Fri Oct 29, 2010 8:49 pm
Been tearing my hair out about this one for the last few hours, and I'm hoping someone here can lend some insight.
I'm trying to make a function in VBA that calls a process. I have two processes, one that takes no parameters, and one that takes 1 parameter, so I need a setup that will handle both scenarios. Here is what I have right now.
No matter what I try to do, I can't seem to get the process to run. I know it doesn't run because it should generate a debug file and doesn't.
Any Ideas?
I'm trying to make a function in VBA that calls a process. I have two processes, one that takes no parameters, and one that takes 1 parameter, so I need a setup that will handle both scenarios. Here is what I have right now.
Code: Select all
Public Function Execute_Process(strServerName As String, strProcessName As String, bParams As Boolean, ParamArray aParams()) As String
Some Stuff happens here to make sure there's a connection, etc...
Dim vaParams As Long
If bParams Then
Dim hHandle() As Long
ReDim hHandle(UBound(aParams))
Dim i As Integer
For i = 0 To UBound(aParams)
If VarType(aParams(i)) = vbString Then
hHandle(i) = TM1ValString(hPool, aParams(i), Len(aParams(i)))
Else
hHandle(i) = TM1ValReal(hPool, aParams(i))
End If
Next i
vaParams = TM1ValArray(hPool, hHandle, UBound(hHandle))
Else
Dim lArray(0) As Long
vaParams = TM1ValArray(hPool, lArray, 0)
End If
Dim hResult As Long
hResult = TM1ProcessExecute(hPool, hProcess, vaParams)
If (TM1ValBoolGet(hUser, hResult) = False) Then
Execute_Process = "Error: Process Executed with Errors"
Exit Function
End If
Execute_Process = ""
End Function
Any Ideas?