error when using IIF with sum()

I have a field I need to have a count for, which is fine, but if that count is equal to nothing I don't want anything to print out in that textbox.

It works if the count is equal to nothing BUT if the count has a value I get an error message.

My logis is
if count = "" then print nothin else print the count

=iif( Sum(Fields!delStatusCount.Value, "dsDelStatusCount") = "", "", "DEL = " & Sum(Fields!delStatusCount.Value, "dsDelStatusCount"))

Thanks



Answer this question

error when using IIF with sum()

  • dataMonkey

    The function sum will return a value. So you can not compare with a string ("") try to replace the string of just =iif(sum(x), x, "").


  • Roy mm

    You can also explicitly state it like:

    =IIF(ISEMPTY(sum(x)), x, "")


  • error when using IIF with sum()