I supply a decimal value, 0.48 to IG Reporting. However, it shows as 0.4800. Why? I cannot specifically format to a number of decimal places, because i do have some values such as 0.4775 that need to be shown with all significant digits. Why would reporting add these insignificant digits to my value? I need to show 0.48 or 0.4775, not 0.4800 and 0.4775!
Hi Travis,
You are using the decimal data type correct? That seems to be the culprit. For example, in my data source I have a field called "salary". When I set this field in code to something like this: salary = 0.4800M;, it appears as you see it now (as "0.4800"). However if I change the data type to a double it trims off the trailing 0s and I get "0.48". This appears to be a .NET behavior though. For example, if I run the following code the output string will show 0.4800:
decimal d = 0.4800M;
string s = d.ToString();
Under the covers the Reporting product is just using the .NET formatting so what you see is expected. If you need to format the decimal value to remove trailing zeros then a FormatString will need to be provided to the Label in the report. Setting it to "G29" should do the trick for decimal values. Don't use this for doubles though. The default formatting for a double is already to trim the trailing zeros.