Report Builder 3
Hi,
Use the below expression to display the number. This is just to ensure it is evaluated as a number with type double. If you are the values bound to the textbox is a decimal number type, you can skip this.
=cdbl(Fields!MyNumber.Value)
Use the below expression for the format property
=iif(cdbl(Fields!MyNumber.Value) mod 1 <> 0,"0.00","0")
When done as shown above, there wont be any decimal values dislayed if its a whole number but 2 decimals will be displayed if there is any decimal value. This is just one of the ways. You can also try dividing by the integer portion of the same number and
see if there is any remainder =iif(cdbl(Fields!MyNumber.Value) mod int(Fields!MyNumber.Value) <> 0,"0.00","")
Please try and comment. Hope this helps
Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
BH
March 14th, 2011 6:29pm
Hi,
Use the below expression to display the number. This is just to ensure it is evaluated as a number with type double. If you are the values bound to the textbox is a decimal number type, you can skip this.
=cdbl(Fields!MyNumber.Value)
Use the below expression for the format property
=iif(cdbl(Fields!MyNumber.Value) mod 1 <> 0,"0.00","")
When done as shown above, there wont be any decimal values dislayed if its a whole number but 2 decimals will be displayed if there is any decimal value. This is just one of the ways. You can also try dividing by the integer portion of the same number and
see if there is any remainder =iif(cdbl(Fields!MyNumber.Value) mod int(Fields!MyNumber.Value) <> 0,"0.00","")
Please try and comment. Hope this helpsPlease click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
BH
Free Windows Admin Tool Kit Click here and download it now
March 14th, 2011 10:45pm
I'm using the expression properties section to limit the number to one decimal places.
How do I if the returned result is a whole number just show the whole number if there is no decimal.
For example: I want to show only 130 if the returned result is 130.0 I want to show 130.5 if the result is 130.5
March 14th, 2011 10:48pm
hi Bilal,
I tried your formula on a returned sum
=iif(cdbl(sum(Fields!MyNumber.Value)) mod 1 <> 0,"0.00","0")
and it just lists 0 and 0.00 for the values, Any idea what I am doing incorrect?
Free Windows Admin Tool Kit Click here and download it now
March 15th, 2011 9:03pm
hi Bilal,
I tried your formula on a returned sum
=iif(cdbl
(sum(Fields!MyNumber.Value)) mod
1 <> 0,"0.00"
,"0"
)
and it just lists 0 and 0.00 for the values, Any idea what I am doing incorrect?
You should use this iif in your property format
if you want to do a SUM and then round the result,
then
iif(cdbl
(sum(Fields!MyNumber.Value)) mod
1 <> 0,Cdbl(sum(Fields!MyNumber.Value))
,CInt(
sum(Fields!MyNumber.Value)))If you think my suggestion is useful, please rate it as helpful.
If it has helped you to resolve the problem, please Mark it as Answer.
http://twitter.com/7Kn1ghts
March 15th, 2011 9:21pm