Custom function created under report properties code section shows as error in column visibility expression editor

Daniel Luchinski 21 Reputation points
2023-04-02T00:55:11.8866667+00:00

I am using Visual Studio Enterprise 2019.

I have a number of columns that I want to show/hide depending on a value that sometimes could be null. Since there doesn't seem to be a coalesce statement in the expression editor, I decided to google it. I found this link...

https://stackoverflow.com/questions/19234993/ssrs-expression-replace-null-with-another-field-value

So, I created the function (code below or in link) under the Report Properties Code. When I use it in the expression builder, I get the red squiggly line under the Isnull. When I preview my report, it seems to work perfectly. I have even deployed the report to the report server and it works there too. Is there a way to get rid of the red squiggly line (or, actually, not have it look like it is an error)? If someone else modifies the report in the future, I don't want them to get stuck thinking there is something wrong.

In my iif statement, I am using a number of columns and parameters that are specific to my report. So, I tested the following, which anyone should be able to use, and it still shows a red squiggly line under the function name.

=iif(Code.IsNull(1,0) = 1, TRUE,FALSE)

Public Function IsNull(input As Object, defaultValue As Object) As Object
  Return IIf(input Is Nothing, defaultValue, input)
End Function
SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Anonymous
    2023-04-03T02:48:16.9333333+00:00

    Hi @Daniel Luchinski

    According to my tests, red squiggles appear whenever you add it using custom code to use in an expression. If there are real syntax errors, the report will not appear in preview and you will receive an error message instead. If you can see a preview, the expression works.

    If you want to remove this red squiggly line, you can set it in Tools->options.

    1

    If the answer is helpful, please click Accept Answer and Up-Vote for the same. If you have any questions, please feel free to let me know.

    Best regards,

    Aniya

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.