Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4155
Varying currency format in Infragistics.Report.Label
posted

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)