Page 1 of 1

TurboIntegrator User Variables

Posted: Mon Oct 27, 2008 4:06 pm
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!!

Re: TurboIntegrator User Variables

Posted: Wed Oct 12, 2011 8:45 pm
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

Re: TurboIntegrator User Variables

Posted: Thu Oct 13, 2011 12:03 pm
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.

Re: TurboIntegrator User Variables

Posted: Thu Oct 13, 2011 1:42 pm
by mnasra
Thank you very much- I will give it a try.

Re: TurboIntegrator User Variables

Posted: Sat Apr 08, 2017 4:31 pm
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?????????????????

Re: TurboIntegrator User Variables

Posted: Mon Apr 10, 2017 3:11 pm
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);