In RDLC report's IIF condition's else block always executed and throwing the exception

40 Views Asked by At

I am trying to execute the below expression in RDLC report against the column MyColumn,


=IIF(IsNothing(Fields!Incident_Custom_Column_152.Value)=True,
    "Nothing",
    Fields!Incident_Custom_Column_152.value.IndexOf("/")
)

And I am getting the #Error when Incident_Custom_Column_152.value is null. Please let us know why else block evaluated?

1

There are 1 best solutions below

1
Abdul Salam On BEST ANSWER

I have resolved the issue by adding the custom function and then called custom function from column expression,

function

Public Function TestFucntion(ByVal rca as String) as String Dim result as String If IsNothing(rca) Then result=rca Else If(rca.IndexOf("/") = -1) Then result=rca.Substring(0, Len(rca) - rca.IndexOf("/") - 1 ) Else result=rca End If End If Return result End Function

called like below in column expression

=Code.TestFucntion(Fields!Incident_Custom_Column_153.Value)