Hello,
I m using ASCIIOUTPUT in a TI to export data and I would like to get figures rounded with only one digit after the decimal point.
I thought it had something to do with the format attribute of my element but it doesn't affect it !!
Any tips to do so ???
Regards,
ASCIIOUTPUT : how to truncate figures
-
- Posts: 2
- Joined: Tue Sep 04, 2012 1:38 pm
- OLAP Product: Tm1
- Version: 9.5.2
- Excel Version: Office 2010
-
- MVP
- Posts: 1831
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: ASCIIOUTPUT : how to truncate figures
Search the TM1 reference guide for "round" and the first 2 options are:
# "Round"
# "RoundP"
# "Round"
# "RoundP"
Declan Rodger
- qml
- MVP
- Posts: 1098
- Joined: Mon Feb 01, 2010 1:01 pm
- OLAP Product: TM1 / Planning Analytics
- Version: 2.0.9 and all previous
- Excel Version: 2007 - 2016
- Location: London, UK, Europe
Re: ASCIIOUTPUT : how to truncate figures
In order to export any numeric values using ASCIIOUTPUT you need to convert them to string values first anyway. One of the functions that allow you to do this is STR() - others being NumberToStringEx() and NumberToString(). If you choose the STR() function then you'll find that its third and mandatory argument allows you to specify the decimal precision. If you are actually exporting any numbers as you claim, you must be doing such number-to-string conversion already.
Something like this will do the trick (TRIM lets you get rid of trailing spaces that would get added to keep the length of the generated string as 20):
Something like this will do the trick (TRIM lets you get rid of trailing spaces that would get added to keep the length of the generated string as 20):
Code: Select all
ASCIIOUTPUT ('export.csv', V1, V2, V3, ..., TRIM (STR (Value, 20, 1));
Kamil Arendt
-
- Posts: 2
- Joined: Tue Sep 04, 2012 1:38 pm
- OLAP Product: Tm1
- Version: 9.5.2
- Excel Version: Office 2010
Re: ASCIIOUTPUT : how to truncate figures
Thank you for your answers !!! They match exactly my needs !!!!