TM1 API Process Call with Parameters

Post Reply
aking
Posts: 32
Joined: Mon Oct 18, 2010 8:45 pm
OLAP Product: Cognos TM1
Version: 10.2.2
Excel Version: 365

TM1 API Process Call with Parameters

Post 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?
User avatar
Martin Ryan
Site Admin
Posts: 2003
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: TM1 API Process Call with Parameters

Post 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
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
aking
Posts: 32
Joined: Mon Oct 18, 2010 8:45 pm
OLAP Product: Cognos TM1
Version: 10.2.2
Excel Version: 365

Re: TM1 API Process Call with Parameters

Post 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
Post Reply