TurboIntegrator User Variables

Ideas and tips for enhancing your TM1 application
Post Reply
User avatar
Steve Vincent
Site Admin
Posts: 1048
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 » Mon Oct 27, 2008 4:06 pm

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: TM1 64 bit 10.2.2, Windows 2008/2012 Server. Excel 2010, IE11 for t'internet

mnasra
Posts: 66
Joined: Tue Aug 10, 2010 5:40 pm
OLAP Product: TM1
Version: 9.5
Excel Version: EXCEL 2010

Re: TurboIntegrator User Variables

Post by mnasra » Wed Oct 12, 2011 8:45 pm

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: 1036
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: TurboIntegrator User Variables

Post by qml » Thu Oct 13, 2011 12:03 pm

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: 66
Joined: Tue Aug 10, 2010 5:40 pm
OLAP Product: TM1
Version: 9.5
Excel Version: EXCEL 2010

Re: TurboIntegrator User Variables

Post by mnasra » Thu Oct 13, 2011 1:42 pm

Thank you very much- I will give it a try.
Thanks
Micheline

Drg
Posts: 52
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 » Sat Apr 08, 2017 4:31 pm

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
Posts: 52
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 » Mon Apr 10, 2017 3:11 pm

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