TM1 VBA param

Post Reply
Jayme1
Posts: 14
Joined: Thu Mar 27, 2014 5:30 pm
OLAP Product: turbo intergrator
Version: cognos express
Excel Version: Excel 2009

TM1 VBA param

Post 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
lotsaram
MVP
Posts: 3652
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: TM1 VBA param

Post 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.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
David Usherwood
Site Admin
Posts: 1453
Joined: Wed May 28, 2008 9:09 am

Re: TM1 VBA param

Post 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.
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: TM1 VBA param

Post 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.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: TM1 VBA param

Post 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?
Robin Mackenzie
Post Reply