Page 1 of 1
[TI] Round, Truncate
Posted: Tue Feb 01, 2011 4:21 pm
by Jonsulli
Hello,
2 questions about TI,
- How can I truncate with turbo integrator ?
- How can I round data to export it ? for example I want a csv file with 2 decimals.
Many thanks for you help,
Jon
Re: [TI] Round, Truncate
Posted: Tue Feb 01, 2011 4:44 pm
by Jonsulli
For the Rounding, I used roundp(formula,2) into a rule before exporting so now I have almost figures with 2 decimals but some look like : xx.9999999999 or xx.00000001 anyway to truncate it ?
Re: [TI] Round, Truncate
Posted: Tue Feb 01, 2011 6:02 pm
by tomok
TM1 uses the equivalent of the SQL Float data type. I believe, and sometimes numbers that go in as 1 end up in the cube like .99999999999 or 1.000000001. There is no way to remedy this in the cube. You have to account for it in your report formatting. If you export the data by right-clicking on the view or cube and choose Export, you can't do anything about it either. However, if you export the data through TI you can alter the formatting of the output with the NumberToStringEx function.
Re: [TI] Round, Truncate
Posted: Tue Feb 01, 2011 7:35 pm
by Alan Kirk
tomok wrote:However, if you export the data through TI you can alter the formatting of the output with the NumberToStringEx function.
Or, if you want no formatting at all (such as if it's going to be reimported into another system) the Str() function.
Re: [TI] Round, Truncate
Posted: Wed Feb 02, 2011 9:15 am
by Jonsulli
Ok so I want to reimport the csv file into another system so I used Str() function into the variable process as : V8=STR(Value,0,2) and it looks good
I find out how to truncate, this is the SUBST function as Susbstring... (shame on me

...)
Re: [TI] Round, Truncate
Posted: Wed Feb 02, 2011 1:06 pm
by tomok
Jonsulli wrote:Ok so I want to reimport the csv file into another system so I used Str() function into the variable process as : V8=STR(Value,0,2) and it looks good

You really should do:
STR(ROUNDP(Value,2),0,2)
Just using the STR function alone will truncate everything to the right of the specified decimal point where you probably should round it first, then truncate and export.
Re: [TI] Round, Truncate
Posted: Wed Feb 02, 2011 1:11 pm
by Jonsulli
Ok I will try STR(ROUNDP(Value,2),0,2) thanks !
I notice another problem if I use V8=STR(Value,30,2), I have a lot of space chars so to resolve the problem I do V8=STR(Value,30,2) then V9=TRIM(V8); It looks OK no more space chars