Page 1 of 1

ExecuteProcess returning values

Posted: Sat Mar 05, 2011 11:12 pm
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

Re: ExecuteProcess returning values

Posted: Sun Mar 06, 2011 1:13 am
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

Re: ExecuteProcess returning values

Posted: Sun Mar 06, 2011 9:16 am
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,

Re: ExecuteProcess returning values

Posted: Sun Mar 06, 2011 10:15 am
by damientaylorcreata
Perfect! Global variables will certainly do the trick! I have implemented this and it works perfectly.

Thanks,
Damien

Re: ExecuteProcess returning values

Posted: Sun Mar 06, 2011 10:50 am
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

Re: ExecuteProcess returning values

Posted: Wed Feb 08, 2012 6:21 am
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?

Re: ExecuteProcess returning values

Posted: Wed Feb 08, 2012 8:32 am
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.