COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: dpccgf on 17 Jul 2018 02:56:24 PM

Title: Export Number to CSV with 2 Decimals
Post by: dpccgf on 17 Jul 2018 02:56:24 PM
Is there a way to have a number exported to CSV always contain 2 decimal places?  Example, 1115.1 would export as 1115.10, 23 would export as 23.00.  Reporting formatting works fine and exporting to Excel works fine.  I just need the same formatting to be applied to the CSV file.  If it cannot be done via something in the report, can it be formatted in Framework Manager as a number with two decimal places then when the package is published and the report run it works?  TIA
Title: Re: Export Number to CSV with 2 Decimals
Post by: sdf on 17 Jul 2018 04:08:29 PM
have you tried format masking?
or if possible convert the values to string.
Title: Re: Export Number to CSV with 2 Decimals
Post by: dougp on 17 Jul 2018 05:31:33 PM
CSV is just values, not formatting.  In your data item, you can cast to a character data type and format it.  This may produce the correct output in CSV.  Unfortunately, if you plan to open the CSV in Excel you're out of luck.  Excel doesn't know how to properly read a CSV.  It will likely convert it back to a number and bork your formatting.