Page 1 of 1

TM1 VBA param

Posted: Mon Jun 15, 2015 10:09 am
by Jayme1
Hello everyone, I hope you can help.

I have a VBA code that runs a TM1 process. before i have only had one parameter so just used a simple code like this.


pParam = Range("B2").Value

bCheck = ExcecuteProcess(sServer, sProcess, pParam)


however i now have two parameters, so i tried this,


pParam = Range("B2").Value
pParam2 = Range("B3").Value

bCheck = ExcecuteProcess(sServer, sProcess, pParam, pParam2)




This didn't work, so can someone tell me how to add the second Parameters in the VBA code?


Thanks
jaimie

Re: TM1 VBA param

Posted: Mon Jun 15, 2015 11:23 am
by lotsaram
Please start by reading the request for assistance guidelines.

How do you expect anyone to be able to help when you have provided no information of the VBA function being called?
Maybe it was only coded to allow for one TI process parameter...
Maybe it was coded for the 3rd argument to be the parameter array and the 4th argument is unexpected ...
Maybe there is a string/numeric type mismatch between expected data type and what has being passed ...

The point is who knows? You haven't provided the information needed so why should anyone waste their time guessing.

Re: TM1 VBA param

Posted: Mon Jun 15, 2015 5:18 pm
by David Usherwood
It's probably worth noting that the VBA process ExcecuteProcess (or quite possibly ExecuteProcess) is not part of standard TM1 - which is why you will struggle to get assistance on this forum.

Re: TM1 VBA param

Posted: Mon Jun 15, 2015 6:31 pm
by Alan Kirk
To expand on what David was saying (and without in any way disagreeing with the points that Lotsaram made), it's most likely a wrapper function that someone has written around the TM1 API. TM1 Tools (which can be downloaded here) has a similar function, so you can see how the function handles multiple arguments there. However the need for such a function has greatly lessened since Action Buttons came along.

Re: TM1 VBA param

Posted: Wed Jun 17, 2015 11:19 am
by rmackenzie
Jayme1 wrote:pParam = Range("B2").Value
bCheck = ExcecuteProcess(sServer, sProcess, pParam)
David Usherwood wrote:It's probably worth noting that the VBA process ExcecuteProcess (or quite possibly ExecuteProcess) is not part of standard TM1
The apparent typo actually gives away that the OP is probably trying to run the code that did the rounds for many a whiles back in the day. Supposing it is, or is close to, it's original form then the method call would use a ParamArray e.g.

Code: Select all

Public Sub ExcecuteProcess(ByVal sServer As String, ByVal sProcess As String, ParamArray args() As Variant)
    Dim ix As Integer
    For ix = 0 To UBound(args)
        Debug.Print CStr(args(ix))
    Next ix
    'call api code etc etc...
End Sub

Sub RunProcess()
     ExcecuteProcess "SERVER_NAME", "PROCESS_NAME", "pYear", "FY15", "pPeriod", "Jun"
End Sub
The interesting feature of the OP's question is that they present the problem is if they only ever passed the value and never the key i.e. parameters can be optionally passed but should go as key-value pairs.
lotsaram wrote:The point is who knows? You haven't provided the information needed so why should anyone waste their time guessing.
A guess is worth a thousand tears, right?