Page 1 of 1
ASCIIOUTPUT : how to truncate figures
Posted: Thu Sep 06, 2012 3:51 pm
by Nicolas_tm1
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,
Re: ASCIIOUTPUT : how to truncate figures
Posted: Thu Sep 06, 2012 3:54 pm
by declanr
Search the TM1 reference guide for "round" and the first 2 options are:
# "Round"
# "RoundP"
Re: ASCIIOUTPUT : how to truncate figures
Posted: Thu Sep 06, 2012 7:24 pm
by qml
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):
Code: Select all
ASCIIOUTPUT ('export.csv', V1, V2, V3, ..., TRIM (STR (Value, 20, 1));
Re: ASCIIOUTPUT : how to truncate figures
Posted: Fri Sep 07, 2012 9:56 am
by Nicolas_tm1
Thank you for your answers !!! They match exactly my needs !!!!