How to get variables value from TI

Post Reply
kiss351523
Posts: 51
Joined: Thu May 05, 2011 2:05 am
OLAP Product: TM1
Version: 9.5
Excel Version: 2007 and 2003
Location: Asia

How to get variables value from TI

Post by kiss351523 »

Dear All:
There is a TI,DataSource is ODBC,i have make a cycle for get the variables from a subset(fields are elements in the dimension),then,how to get the variables value ?


i = 1;
n = SubsetGetSize(vDimName,vSubsetName);

WHILE( i <= n);

#v_col is a field from DataBase via ODBC.
v_col = SubsetGetElementName(vDimName,vSubsetName,i);

Asciioutput('..\test.csv',v_col,{i want to get the v_col's value from DataBase});
i = i + 1;
END;
lotsaram
MVP
Posts: 3706
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: How to get variables value from TI

Post by lotsaram »

kiss351523 wrote:Dear All:
There is a TI,DataSource is ODBC,i have make a cycle for get the variables from a subset(fields are elements in the dimension),then,how to get the variables value ?


i = 1;
n = SubsetGetSize(vDimName,vSubsetName);

WHILE( i <= n);

#v_col is a field from DataBase via ODBC.
v_col = SubsetGetElementName(vDimName,vSubsetName,i);

Asciioutput('..\test.csv',v_col,{i want to get the v_col's value from DataBase});
i = i + 1;
END;
It really isn't clear exactly what you are trying to do here or if you understand the basic principles of how TI works. Look at your "variables" tab in the TI process editor, these are the fields you are bringing in from your data source query. The process will read the variables one record at a time and you can then read or manipulate the variables in either the meta data or data tabs which are both "implicit loops" as every line of code there is executed for each record in the data source. It is not clear what you are attempting to do by looping through a subset (or how this would be relevant in any way to your ODBC data source).

Maybe you could try explaining your problem and what you are trying to achieve again more carefully?
User avatar
Steve Rowe
Site Admin
Posts: 2464
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: How to get variables value from TI

Post by Steve Rowe »

Just in case your script is in the prolog...
When the TI in the prolog is executed the data source has not been opened yet and so all the variables that relate to the data source are not yet defined.

If this is your sitation then
in prolog put
ixLoop=1;

at the start of data or metadat put

If (ixLoop=1);
#All the code that you want to execute once and access values in the data

ixLoop=2;
EndIf;

If that isn't it then like lotsa says we need a load more information to help
Cheers
Technical Director
www.infocat.co.uk
Post Reply