ExecuteProcess returning values

Post Reply
User avatar
damientaylorcreata
Posts: 86
Joined: Mon Apr 13, 2009 8:47 am
OLAP Product: Cognos TM1
Version: 9.4
Excel Version: 2003 and 2007
Location: Sydney, Australia
Contact:

ExecuteProcess returning values

Post by damientaylorcreata »

Hi Guys,

I am needing to create a recursive script/function in my TI drill process. I want to get all n levels for a particular consolidation and thought that I could create a recursive process that will take an element name as a arguement and return return a comma seperated string of all child elements to n level depth.

I looked at using the ExecuteProcess function as I could pass in parameters, however it does not allow you to pass back a value, instead it only returns an error code. Anyone have any other ideas on how I could create a function or process that will accept parameters and return values?

Otherwise I will have to use ExecuteProcess and save the values either to a text file or cube cell. Which seems very clunky and IO intensive. Maybe there is an alternative function I could use instead of ExecuteProess?

Thanks,
Damien
Damien Taylor
User avatar
Martin Ryan
Site Admin
Posts: 1989
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: ExecuteProcess returning values

Post by Martin Ryan »

I've come across this problem before and just got around it by running through the entire dimension and checking if it was a descendant using elisanc. It's slower than an internal recursive function would be, but much faster than calling subprocesses.

HTH,
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
User avatar
Steve Rowe
Site Admin
Posts: 2455
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

Re: ExecuteProcess returning values

Post by Steve Rowe »

TI Will also allow you to delcare global variables, this might allow you to do what you need. Note that recursive TIs have a limit of I think around 100 recursive calls and that when it fails, it fails hard and the server comes down.(last tested in 9.0 I think)
TurboIntegrator Global Variables
This type of TurboIntegrator variable is associated with an individual TM1 chore or with an individual process and any attendant sub-processes. There are two types of global variables: implicit and user-defined. Implicit global variables are described here. User-defined global variables are described below.
Global variables can be used in two ways:
• Global variables can be declared within a process that is part of a given chore. Once declared, the global variables are available to all other processes that are part of the chore. The variables persist while the chore is executing, and are destroyed when the chore exits.

• Global variables can be declared in one process and be made available to any subsequent processes called by the ExecuteProcess( ) function. These sub-processes must use the same global variable declaration statements (described below) to access the global variables.

Global variables are declared in a TurboIntegrator process using one of the following two functions:
NumericGlobalVariable('VariableName'); Use this function to declare a numeric global variable.
StringGlobalVariable('VariableName'); Use this function to define a string global variable.

In the event that a global variable name is identical to a local variable name, the local variable definition takes precedence and overrides the global variable.
Cheers,
Technical Director
www.infocat.co.uk
User avatar
damientaylorcreata
Posts: 86
Joined: Mon Apr 13, 2009 8:47 am
OLAP Product: Cognos TM1
Version: 9.4
Excel Version: 2003 and 2007
Location: Sydney, Australia
Contact:

Re: ExecuteProcess returning values

Post by damientaylorcreata »

Perfect! Global variables will certainly do the trick! I have implemented this and it works perfectly.

Thanks,
Damien
Damien Taylor
Wim Gielis
MVP
Posts: 3223
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: ExecuteProcess returning values

Post by Wim Gielis »

I do not have all information necessary I think, but would it not be an option to create a subset using CreateSubsetByMDX? Then loop through it.

Wim
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
sg2012
Posts: 27
Joined: Tue Jan 10, 2012 9:13 am
OLAP Product: Tm1 Cognos
Version: 9.5.2
Excel Version: 2007

Re: ExecuteProcess returning values

Post by sg2012 »

damientaylorcreata wrote: I looked at using the ExecuteProcess function as I could pass in parameters, however it does not allow you to pass back a value, instead it only returns an error code. Anyone have any other ideas on how I could create a function or process that will accept parameters and return values?

Otherwise I will have to use ExecuteProcess and save the values either to a text file or cube cell.
Can we return values in Excel Cell?
If so Can anyone please suggest how?
lotsaram
MVP
Posts: 3698
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: ExecuteProcess returning values

Post by lotsaram »

sg2012 wrote:[Can we return values in Excel Cell?
If so Can anyone please suggest how?
Yes.

Write out comment to cube in TI with CellPutS. read comment in Excel with DBRW.
Post Reply