Search code examples
c#asp.net

asp.net C# Rdlc Report Sum #Error in column


Dear all coder please help me with this, I am having a column of student marks in my report and the row of the columns contains both Number as mark and Text as Grade. So when I sum the total of the column it throws an error #Error, where as when I replaced the Text or grade from the row as a number then it gives the correct result. But I want it to give the sum even when it contains the Text in the row, it should only calculate the Number and avoid Text. Please Help Me!!

enter image description here


Solution

  • Posting as an answer from my above comment. It may be helpful to someone. SSRS IIF evaluates both true and false expression no matter what IIf condition evaluates to so casting needs to be done after IIF evaluates.

       =Sum(CInt(IIF(IsNumeric(Fields!FirstSecond.Value), Fields!FirstSecond.Value, 0)))