Passing TI Parameters to a DOS .cmd file

Post Reply
User avatar
kielmc
Posts: 22
Joined: Tue Jun 24, 2008 6:17 pm
OLAP Product: TM1
Version: 10.2.2 FP4
Excel Version: 2013
Location: Birmingham, AL

Passing TI Parameters to a DOS .cmd file

Post by kielmc »

Is it possible to pass TI Parameter variables to a dos batch file?

I can call a DOS batch file using the following:

ExecuteCommand('C:\test.cmd', 1);

and everything works fine. However, if I try to add parameters, the .cmd file won't run...

ExecuteCommand('C:\test.cmd p1 p2', 1);

any thoughts?

thanks!
User avatar
Mike Cowie
Site Admin
Posts: 482
Joined: Sun May 11, 2008 7:07 pm
OLAP Product: IBM TM1/PA, SSAS, and more
Version: Anything thru 11.x
Excel Version: 2003 - Office 365
Location: Alabama, USA
Contact:

Re: Passing TI Parameters to a DOS .cmd file

Post by Mike Cowie »

Hi,

Have you looked at the TI EXPAND function? It takes a string containing references to TI variables (which parameters are) and "expands" the contents of the variable into the string. So, using your example:

Code: Select all

ExecuteCommand(EXPAND( 'C:\test.cmd %p1% %p2%' ), 1);
Here I'm assuming that you have 2 TI parameters (both String type) called p1 and p2.

As far as how it works, let's say you have the following values:
  • p1=Hello
  • p2=World
When the TI process runs the ExecuteCommand will effectively get this command string passed into it:

Code: Select all

ExecuteCommand('C:\test.cmd Hello World', 1);
Hope that helps.

Regards,
Mike Cowie
QueBIT Consulting, LLC

Are you lost without Print Reports in Planning Analytics for Excel (PAfE)? Get it back today, for free, with Print Reports for IBM Planning Analytics for Excel!
User avatar
kielmc
Posts: 22
Joined: Tue Jun 24, 2008 6:17 pm
OLAP Product: TM1
Version: 10.2.2 FP4
Excel Version: 2013
Location: Birmingham, AL

Re: Passing TI Parameters to a DOS .cmd file

Post by kielmc »

Thanks Mike, that function is exactly what I'm looking for!
Post Reply