Page 1 of 1

TM1 API Process Call with Parameters

Posted: Fri Oct 29, 2010 8:49 pm
by aking
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.

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
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?

Re: TM1 API Process Call with Parameters

Posted: Mon Nov 01, 2010 10:49 pm
by Martin Ryan
Here's a working one, you can pick and choose what you need: http://forums.olapforums.com/viewtopic.php?f=3&t=3410

Martin

Re: TM1 API Process Call with Parameters

Posted: Tue Nov 02, 2010 1:31 pm
by aking
Thanks,

but I actually found a post that I was able to use. This is the link for reference http://forums.olapforums.com/viewtopic.php?f=3&t=791