Reputation: 307
I am having a problem with a simple nested IIF statement on SSRS. I am trying to do the second part where if the number is a "-"
then it should return a "-"
.
=IIF(Fields!fbrt_number.Value < "0",Fields!fbrt_number.Value, "+")
Thanks
Upvotes: 0
Views: 3249
Reputation: 63830
It's unclear what you're exactly after. I'm assuming you want to prefix all numbers (including positive numbers and zero) with a sign.
Here's what your code currently does:
fbrt_number
's value with the string "0"Are you perhaps after this:
=IIF(Fields!fbrt_number.Value < 0,
"-" + Fields!fbrt_number.Value.ToString(),
"+" + Fields!fbrt_number.Value.ToString())
This will compare the field value to the number 0, and depending on the result prefix a "-" or a "+".
Or, if you want to display just a "+" for positive values, and a "-" for negatives:
=IIF(Fields!fbrt_number.Value < 0,
"-",
"+")
Finally, if you want an empty string for 0 then this will work:
=IIF(Fields!fbrt_number.Value < 0,
"-",
IIF(Fields!fbrt_number.Value > 0, "+", ""))
Note that if your field isn't actually a number yet you may need to cast it first (either in your dataset query, or using SSRS expressions).
Upvotes: 2