Page 1 of 1

How to get variables value from TI

Posted: Thu Dec 01, 2011 5:45 am
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;

Re: How to get variables value from TI

Posted: Thu Dec 01, 2011 8:22 am
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?

Re: How to get variables value from TI

Posted: Thu Dec 01, 2011 11:41 am
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