[BC30451] Name 'code' is not declared.

  • Hi all,

    I am using "code.matrixcellvalue" in my matrix in a report. this is the script:

    =code.matrixcellvalue(

    Count(Fields!emp_id.Value)

    ,avg(Fields!Age.Value)

    ,InScope("matrix1_emp_category") and InScope("matrix1_Age")

    ,"{0,6:N0}"

    ,"{0,6:N0}")

    The problem is when I try to preview the report it comes up with this erro:

    [rsCompilerErrorInExpression] The Value expression for the textbox ‘textbox3’ contains an error: [BC30451] Name 'code' is not declared.

    What is strange is that I am using the exact code in another report and that report has no problem. The only difference is that the other report is in another solution.

    Any suggestion?

  • Well I found my answer 🙂

    As "code.matrixcellvalue" is a custom It needs to add the following script to the

    Report Property -> code

    Public Function MatrixCellValue(ByVal sumValue As Object, ByVal avgValue As Object, ByVal InScope As Boolean, ByVal sumFormat As String, ByVal avgFormat As String) As Object

    If InScope Then

    Return sumValue

    Else

    If Not avgValue Is Nothing Then

    Return String.Format(sumFormat, CDbl(sumValue)) + vbCrLf + String.Format(avgFormat, CDbl(avgValue))

    Else

    Return Nothing

    End If

    End If

    End Function

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply