Page 1 of 1
Global Variables
Posted: Fri Aug 30, 2013 8:36 pm
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?
Re: Global Variables
Posted: Fri Aug 30, 2013 9:00 pm
by tomok
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.
Re: Global Variables
Posted: Fri Aug 30, 2013 11:30 pm
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
Re: Global Variables
Posted: Tue Sep 03, 2013 7:02 pm
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
Re: Global Variables
Posted: Tue Sep 03, 2013 8:58 pm
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.
Re: Global Variables
Posted: Fri Sep 27, 2013 12:46 am
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.
Re: Global Variables
Posted: Fri Sep 27, 2013 6:52 am
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.