Hi guys,
I'm import a .csv file to TM1 cube with TI. The file format is attached.
From column F to column Q which highlighted with yellow are product list. I don't want to hardcode each product code in TI, and want to set a loop in the TI code.
vColumnIndex =6;
while(vColumnIndex<=17);
vtypeclass = 'vColumn'|NumbertoString(vColumnIndex);
if(DIMIX('product','vColumn'|NumbertoString(vColumnIndex)) = 0);
ASCIIOutPut('c:\test.txt', vtypeclass );
ENDIF;
vColumnIndex = vColumnIndex + 1;
end;
But the output file only show "vColumn6",ideally I hope it can output column6 value 'A111'. TI consider variable vtypeclass as string,
vtypeclass = 'vColumn6'.
How can I change the vtypeclass value, and use it as variableName? Many thanks.
wendywang
Can use variable in TI Variable Name?
-
- Posts: 16
- Joined: Mon Jan 12, 2015 9:51 am
- OLAP Product: TM1
- Version: 10.2.2
- Excel Version: OFFICE 2007
Can use variable in TI Variable Name?
- Attachments
-
- TI Variable.PNG (39.12 KiB) Viewed 2657 times
-
- source file.PNG (9.55 KiB) Viewed 2657 times
- gtonkin
- MVP
- Posts: 1201
- Joined: Thu May 06, 2010 3:03 pm
- OLAP Product: TM1
- Version: Latest and greatest
- Excel Version: Office 365 64-bit
- Location: JHB, South Africa
- Contact:
Re: Can use variable in TI Variable Name?
Have a look on the forum for 'expand' -you should fine some posts dealing with this requirement.
-
- Regular Participant
- Posts: 159
- Joined: Fri Aug 12, 2016 10:02 am
- OLAP Product: tm1
- Version: 10.2.0 - 10.3.0
- Excel Version: 2010
Re: Can use variable in TI Variable Name?
pStart=6
pEnd=17
vColumnIndex =pStart;
while(vColumnIndex<=pEnd);
vtypeclass = 'vColumn'|NumbertoString(vColumnIndex);
if(DIMIX('product','vColumn'|NumbertoString(vColumnIndex)) = 0);
#create variable name %VAR№%
vtypeclass=EXPAND( ('%vColumn'|NUMBERTOSTRING(vColumnIndex) | '%' ) )
ASCIIOutPut('c:\test.txt', vtypeclass );
ENDIF;
vColumnIndex = vColumnIndex + 1;
end;
pEnd=17
vColumnIndex =pStart;
while(vColumnIndex<=pEnd);
vtypeclass = 'vColumn'|NumbertoString(vColumnIndex);
if(DIMIX('product','vColumn'|NumbertoString(vColumnIndex)) = 0);
#create variable name %VAR№%
vtypeclass=EXPAND( ('%vColumn'|NUMBERTOSTRING(vColumnIndex) | '%' ) )
ASCIIOutPut('c:\test.txt', vtypeclass );
ENDIF;
vColumnIndex = vColumnIndex + 1;
end;
-
- Posts: 16
- Joined: Mon Jan 12, 2015 9:51 am
- OLAP Product: TM1
- Version: 10.2.2
- Excel Version: OFFICE 2007
Re: Can use variable in TI Variable Name?
Dear Drg & gtonkin,
The Expand() function works, the output file prints what I want. Thank you very much.
wendywang
The Expand() function works, the output file prints what I want. Thank you very much.
wendywang