If statement issue in TI

Post Reply
User avatar
Steve Rowe
Site Admin
Posts: 2456
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

If statement issue in TI

Post by Steve Rowe »

Version 9.0 SP3 Update 9

Having a weird issue with TI. Have the code below in the epilog of TI, both processes are getting executed. Which I think is impossible. Anyone had any issues with this version of TM1 and TI?

Code: Select all

If ( Suf @='stop');

ans=ExecuteProcess ('ADMIN - Load MI - Bulk - Period',
'pthToFile', pthToFile,
'nameOfFile', nameOfFile,
'Cycle', Cycle,
'DecimalSep', DecimalSep);

Else;

ans=ExecuteProcess ('ADMIN - Load MI - Bulk - Comma',
'pthToFile', pthToFile,
'nameOfFile', nameOfFile,
'Cycle', Cycle,
'DecimalSep', DecimalSep);

EndIf;

Any thoughts welcomed.....
Technical Director
www.infocat.co.uk
User avatar
Steve Rowe
Site Admin
Posts: 2456
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: If statement issue in TI

Post by Steve Rowe »

Just had a thought that it may be the way I'm getting to the epilog.

Background:
I have a lot of files to load, they all have the same structre from a variety of arcole ledgers. Whilst they have the same structure for some reason only known to a wiser person than me some of the files arrive with the data with a "." as the decimal separator and some with a "," as a seprator. I've tried to get ths fixed at source but with no luck.

Sooo... I need to take a look in each file to see if the data is , or . separated

I do this in the Data tab with the following code.

Code: Select all

If ( Scan ( '.', DebitStr)>0 % Scan ('.', CreditStr)>0);
   DecimalSep='.';
   Suf='stop';
   ProcessBreak;
ElseIf ( Scan ( ',', DebitStr)>0 % Scan (',', CreditStr)>0);
   DecimalSep=',';
   Suf='comma';
   ProcessBreak;
EndIf;
The ProcessBreak takes me to the epilog (see the code above) where I call the process that is set up with a , or . separator.

I'm thinking that becuase I am ProcessBreaking out of the If statement above the next one is breaking? This doesn't help me very much but at least I can understand what is happening....

(FYI I could not get the TI variable where you set the decimal separator to work, hence the need for the If statement in the epilog).
Technical Director
www.infocat.co.uk
Lukas Meyer
Posts: 51
Joined: Thu Jul 24, 2008 6:14 am

Re: If statement issue in TI

Post by Lukas Meyer »

Hi,

If you don't mind some extra execution-time, you could use NumberToStringEx(string,decimalSep,thousandSep), determine the decimalSep as you already do and set the type of your data-value to string.
To optimize it a bit, just look once which one is your decimalSep. (declare variable in prolog (setting it to an empty string ;) )and in data/metadata if(decimalSep @= '') define decimalSep ENDIF; then NumberToStringEx)

It might not be the best approach, but it's easy understandable. (and 5 seconds more or less just don't matter when it takes 15 minutes to import ^^. well, 5 seconds would never bother me when dealing with tm1 :) )

Lukas.
User avatar
Steve Rowe
Site Admin
Posts: 2456
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: If statement issue in TI

Post by Steve Rowe »

Thanks Lukas! I seem to have mental black hole when it comes to that function. You've given me enough for me to code my way round the problem with out havng to call the second process.
Thanks again.
Technical Director
www.infocat.co.uk
Post Reply