Read Folder Name Using TI

Post Reply
mariatjahjadi
Posts: 9
Joined: Wed Oct 19, 2011 9:09 am
OLAP Product: sql
Version: tm1 9.5
Excel Version: 2007

Read Folder Name Using TI

Post by mariatjahjadi »

Dear All,

I am developing TM1 and using TI as ETL tools.

Could someone tell me how to read folder name using TI?

I need to access a file inside the folder, and need to determine who is the owner of the file based on the folder name.

I can do it with SSIS, but have no clue how to do that using TI.

Thanks.
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: Read Folder Name Using TI

Post by Duncan P »

I am a little confused here. How is it that the file is being specified if not by a path?
If there is a path then it will be possible to crack it open using the SCAN and SUBST rule functions that also work in TI.
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: Read Folder Name Using TI

Post by rmackenzie »

Often, with TM1, you just have to write something yourself:

Code: Select all

sPath='c:\test\this\folder name\whatever.txt';

# get the string between the last and second last \
nCounter=LONG(sPath);
nContinue=1;
nFoundFirstBackslash=0;
sFolderName='';
WHILE(nContinue=1&nCounter>0);
  sChar=SUBST(sPath,nCounter,1);
  IF(nFoundFirstBackslash=1&sChar@<>'\');
    sFolderName=sChar|sFolderName;
  ENDIF;
  IF(sChar@='\');
    IF(nFoundFirstBackSlash=1);
      nContinue=0;
    ELSE;
      nFoundFirstBackSlash=1;
    ENDIF;
  ENDIF;
  nCounter=nCounter-1;
END;

# test parse output
AsciiOutput('test_parse.txt',sFolderName);
Robin Mackenzie
Post Reply