Reputation: 31
I am using SSRS to write a report and I am running into a very strange issue. I have numbers that are rounding that I do not want to round.
Below are the expressions that are in play. I have formatted the textbox to display 4 decimals, default, money, custom, and others with no luck. The numbers have the correct decimals to begin with.
So below are the expressions I am using.
Why are the results rounding or truncating when the OR operator is used????
New to SSRS and SQL in general.
Textbox1 has this Expression in it
IIf(Fields!SelQty.Value=1,Fields!EstPrice1.Value * Fields!Qty1.Value,0)
Results
2252.2800,
191.3205,
505.2300,
240.8000`
Textbox2 has this Expression in it
IIf(Fields!SelQty.Value=2,Fields!EstPrice2.Value * Fields!Qty2.Value,0)`
Results
81500.0400,
5914.0800,
58166.1600
Change Textbox1 to this Expression =
IIf(Fields!SelQty.Value=1,Fields!EstPrice1.Value * Fields!Qty1.Value,0)
OR
IIf(Fields!SelQty.Value=2,Fields!EstPrice2.Value * Fields!Qty2.Value,0)
Results
2252,
191,
505,
241,
81500,
5914,
58166
Upvotes: 0
Views: 1334
Reputation: 432311
So 2252.2800 OR 0
gives 2252
because of some type casting. Personally, I've never bitwised numeric numbers so don't know how it works
Why use OR anyway: it makes no sense with Iif
at all. What are you really try to do?
Nested Iif
like this?
=IIf(
Fields!SelQty.Value=1,
Fields!EstPrice1.Value * Fields!Qty1.Value,
IIf(
Fields!SelQty.Value=2,
Fields!EstPrice2.Value * Fields!Qty2.Value,
0
)
)
Upvotes: 1