Why am I getting an "Unknown Identifier" in my custom SSRS code?

I try to use the custom code function in SSRS (SQL Server Reporting Services), but keep getting the message "Unrecognized identifier" in the expression editor.

Here is my code. In fact, the final procedure will be more complicated than this, but I am trying to simplify things to find out why the error occurs.

Public Function GetCutoffDate(batchNumber As String) As DateTime
    Return New DateTime(Now.Year, 12, 31)
End Function

This is how I refer to the code in the expression editor.

=IIf(UCase(Fields!MailId.Value) = "VARIOUS", 
    Code.GetCutoffDate(Fields!BatchNumber.Value), 
    Fields!CutOffDate.Value)

I get a red underline in the "GetCutoffDate" section of Code.GetCutoffDate (..). Also, the “Unrecognized identifier” message appears when I hover over the text “GetCutoffDate”.

What am I missing?

Expression, "Unrecognized identifier" .

=Code.GetCutoffDate(Fiels!BatchNumber.Value)

- , , .

.

+3
2

, , "Unrecognized identifier". , , , .

, "Unrecognized identifier" . .

0

Try

Public Shared Function GetCutoffDate(batchNumber As String) As DateTime ...

, .

0

Source: https://habr.com/ru/post/1718296/


All Articles