TurboIntegrator User Variables

Ideas and tips for enhancing your TM1 application
Post Reply
User avatar
Steve Vincent
Site Admin
Posts: 1054
Joined: Mon May 12, 2008 8:33 am
OLAP Product: TM1
Version: 10.2.2 FP1
Excel Version: 2010
Location: UK

TurboIntegrator User Variables

Post by Steve Vincent »

Don't know how i've missed this over the last 4 years, maybe its the typically vague help files but hell its useful to know!

TurboIntegrator User Variables;
This type of variable is associated with an individual TM1 user, not with any particular process or chore. User variables can be manipulated from within any TurboIntegrator process or chore while the user with which the variable is associated is logged on to the TM1 server.

User variables are declared in a TurboIntegrator process using one of the following two functions:

NumericSessionVariable('VariableName'); Use this function to declare a numeric user variable.
StringSessionVariable('VariableName'); Use this function to define a string user variable.


Example:

TI-1 prolog;
NumericSessionVariable('zSte_Tes_Var');

TI-1 epilog;
zSte_Tes_Var = 616 + 616;

TI-2 prolog;
asciioutput ( '\\tm1data\out.txt' , NumberToString ( zste_tes_var ) );


This means you can pass data from ANY TI to ANY OTHER TI using the TM1 equlivalent of Excel's Global Variables. It doesn't have to be a prompt and the value is persistant for as long as the user that ran the TI declaring the variable is logged in.

There are also "TurboIntegrator global variables";

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.


Same usage i expect, just can't believe it took me so long to find it!!
If this were a dictatorship, it would be a heck of a lot easier, just so long as I'm the dictator.
Production: Planning Analytics 64 bit 2.0.5, Windows 2016 Server. Excel 2016, IE11 for t'internet
mnasra
Posts: 136
Joined: Tue Aug 10, 2010 5:40 pm
OLAP Product: Planning Analytics
Version: 2.0
Excel Version: EXCEL 2013

Re: TurboIntegrator User Variables

Post by mnasra »

Hi Steve,

I am interested with your solution in the above trail.
I am not an expert, so sorry if the question is stupid.
But, in your solution you have:

TI-2 prolog;
asciioutput ( '\\tm1data\out.txt' , NumberToString ( zste_tes_var ) );

It does not work for me:
first of all my variable is ALPHA- so I dont have to put Numbertostring (I guess?)
second: do I really put exactly this: '\\tm1data\out.txt' ??

WHat I want to do is PASS a variable from one TI Process to another in the same chore.

THANKS a lot
Micheline
Thanks
Micheline
User avatar
qml
MVP
Posts: 1094
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: TurboIntegrator User Variables

Post by qml »

Steve Vincent wrote:TI-2 prolog;
asciioutput ( '\\tm1data\out.txt' , NumberToString ( zste_tes_var ) );
This part is simply an example of how you can directly reference a user variable that has been assigned a value in a different process. You do not have to use any of this code to make this solution work. Variable zSte_Tes_Var (again - this is the name of the variable in this particular example) can be used in your code like any other variable would be.
Kamil Arendt
mnasra
Posts: 136
Joined: Tue Aug 10, 2010 5:40 pm
OLAP Product: Planning Analytics
Version: 2.0
Excel Version: EXCEL 2013

Re: TurboIntegrator User Variables

Post by mnasra »

Thank you very much- I will give it a try.
Thanks
Micheline
Drg
Regular Participant
Posts: 158
Joined: Fri Aug 12, 2016 10:02 am
OLAP Product: tm1
Version: 10.2.0 - 10.3.0
Excel Version: 2010

Re: TurboIntegrator User Variables

Post by Drg »

Sorry that I raise old posts

Tell me whether it is possible to avoid the isolation level by using global variables?

Example:
Process_1: get one variable n
n=n+1;
#run second process no wait execution
ExecuteCommand('"..tm1runti.exe" -adminhost "hst" -server "INst" -user "admin" -pwd "apple" -process "Process_2" ', 0);
#get global variable
NumericGlobalVariable('OpenThreadsNow');
LOGOUTPUT('INFO' , 'Process 1:' | NUMBERTOSTRING(n) |' '| NUMBERTOSTRING(OpenThreadsNow) );
IF(n=10);
processbreak;
ENDIF;
#run it self
ExecuteProcess( 'Process_1' ,'n', n );

Process_2: get one variable n
NumericGlobalVariable('OpenThreadsNow');
OpenThreadsNow=OpenThreadsNow+1;
LOGOUTPUT('INFO' , 'Process 2:' | NUMBERTOSTRING(n) |' '| NUMBERTOSTRING(OpenThreadsNow) );

IN log we see
Process 1:0 0
Process 1:1 0
Process 1:2 0
...
Process 1:10 0

Process 2: 1 ALWAYS

i try use WHILE instead ExecuteProcess( 'Process_1' ,'n', n ); bad result again
i try use cellincrementput instead use global variable bad result again
The only thing that works is the use javaextension class.
Is there any correct solution for determining the number of working parralel processes?????????????????
Drg
Regular Participant
Posts: 158
Joined: Fri Aug 12, 2016 10:02 am
OLAP Product: tm1
Version: 10.2.0 - 10.3.0
Excel Version: 2010

Re: TurboIntegrator User Variables

Post by Drg »

Simply solution:
:P :P :P :P :P :P :P
Thread=10;
SCRIPT='powershell -command "& { while((get-process | Where-Object name -EQ "tm1runti").count -gt '|NUMBERTOSTRING(Thread)|' ){sleep -Seconds 1} } "';
ExecuteCommand(SCRIPT, 1);
Post Reply