Global Variables

Post Reply
erik664
Posts: 18
Joined: Fri Mar 08, 2013 6:11 pm
OLAP Product: TM1
Version: 10.1.1
Excel Version: 2007

Global Variables

Post by erik664 »

Do the values of Global Variables persist between processes in a chore?

I've been reading over the documentation here,

http://pic.dhe.ibm.com/infocenter/ctm1/ ... /index.jsp

but don't quite understand it. If I defined a global variable, say,

STRINGGLOBALVARIABLE('Month');
Month = 'April';

Will the value of the 'Month' global variable persist throughout the rest of the processes in the chore?
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Global Variables

Post by tomok »

erik664 wrote:I've been reading over the documentation here,

http://pic.dhe.ibm.com/infocenter/ctm1/v10r1m0/index.j
Did you miss this little snippet?
•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.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Darkhorse
Posts: 141
Joined: Wed Mar 09, 2011 1:25 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2003 2007 2010 2013

Re: Global Variables

Post by Darkhorse »

Hi

Create an execute process that runs multiple tis

This allows you to pass a global variables (as you call them )between TI's in the order in which you run them

Executeprocess( TI name, param1, variable1, param2, variable2)
Executeprocess( TI name, param1, variable1, param2, variable2)

Then set this as your chore
User avatar
Steve Rowe
Site Admin
Posts: 2456
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: Global Variables

Post by Steve Rowe »

Just a word of warning on using global vars, they can make your code hard to look after from a testing and debugging perspective. This is because once you have the TIs "chained" together with global vars its no longer possible to run each step of the job independently of each other. So if TI6 has an issue you need to run TIs 1 to 5 before you get to the problem, which can soak up a lot of time.

Rather than a chore as a sequence of independent TIs with global vars passing information between them you are probably better off either

1. Having a set of TIs in the chore where the global vars are held in a cube. Then you can put what you like in your "global vars" cube and run TI6 on its own.
or
2. One master Ti that you schedule in a chore, the master TI uses ExecuteProcess and TI parameters take the place of global vars. This means that you can always call TI6 on its own and supply your own parameters if you need to launch it manually.

99% of the time approach 2 is what I would do, I hesitate to use the phrase "best practice" as its a bit of marketing BS phrase, it is certainly my best practice.

Global Vars on paper looks like great functionality, I've only used it once in practice and it was such a pain to develop and test the TIs with it in place that I had to rip them all out and revert to approach 2.

Just my 2p
Technical Director
www.infocat.co.uk
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: Global Variables

Post by Duncan P »

Global variables are useful as a means to pass a result out of a TI. We have a convention that if a TI needs to return a result it can declare a global variable of the same name and set its value at the end. Then the calling process also declares it and checks the value immediately after it returns.
Frankxis
Posts: 1
Joined: Thu Feb 11, 2010 8:39 pm
OLAP Product: TM1
Version: 9.5.x 10.1 10.2.2
Excel Version: 00-03-07-10-13

Re: Global Variables

Post by Frankxis »

I've always favored creating my own Cube... using all existing dimension even system ones if need be, so to maintain "Gloabl Variables" data.
This way you get: independant TIs , with centralized triggers/parameters, build all the Chores you wish, order your TIs as you want.

... one way among others(sss)... anyway your decision should be based on your context.
Gabor
MVP
Posts: 170
Joined: Fri Dec 10, 2010 4:07 pm
OLAP Product: TM1
Version: [2.x ...] 11.x / PAL 2.0.9
Excel Version: Excel 2013-2016
Location: Germany

Re: Global Variables

Post by Gabor »

I used to have control cubes for handling TI parameters, which worked fine, as long as running a TI caused to stop all other actions on the server anyway.

When TM1 started to enable parallel TI processing in later 9.x version, I saw subsequent processes waiting due to a write lock on the whole parameter cube, caused by a prior process, which was still running in parallel.

I could get rid of this kind of locks by using global variables.
Post Reply