I have a decimal value i need varying places of precision to be displayed in the PDF i create using Reporting. If the value is 1.3800, i need to display $1.38. However, if the value is 1.3833, I need to display $1.38. How can i format as currency AND yet allow the value to show up to four digits after the decimal, but also truncate to only 2 if the value contains the two trailing zeros? Obviously I can't simply set the Label->Text->FormatString to c2, because this will not show the 3rd and 4th places if they are other than zero. Basically I just need to truncate to 2 digits ONLY when the digits are not zeroes, and then show the $ sign etc. I also need to show empty string if the value is equal to zero. Here's what I have so far:
=If(Fields.CalcBillingRate<>0,(Format("${0}", Fields.CalcBillingRate)),"")
which works fine except it doesn't truncate the value to two places when the value is, for example, 2.0000 (should show $2.00)
Hello Travis,
Currently, I'm not sure this could be done through the report with the built-in reporting functionality, but I do believe it can be done if you do it through your data. I would recommend adding a bool property to each data item of your underlying data source that you can use in your If statement for formatting the values. You could determine this bool value by parsing your CalcBillingRate property for each data item and setting it to true or false based on whether the Format should be set to allow 4 decimal points or 2. Then, you could use the if statement to check your Fields.Bool property for true or false and set the formatting accordingly.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewDeveloper Support Engineer IInfragistics Inc.www.infragistics.com/support
I don't understand what you mean. In Reporting, I can somehow have an IF statement that allows me to set FormatString to c2 OR c4 depending on a boolean? How do i do this?
...because when i supply a decimal value of 0.48 and don't have IG Reporting apply ANY formatting, i get 0.4800!!!