SSRS Custom Code IF-THEN-ELSE Syntax Error

  • Hello All,

    I am trying to use this simple function in the Custom Code section of my SSRS report but it always throws an Syntax error. Could anyone help me to solve this?

    Basically, I input a multi-value parameter to this function and check whether the 5th value contains the word Vital. If it has that word I need to display "Value Found" else "Value Not Found".

    Public Function ShowParmValues(ReportParameter1 as object()) as string

    Dim s as String

    Dim i as Integer

    IF ReportParameter1.Getvalue(5) LIKE "Vital*"

    THEN s = "Value Found"

    ELSE s = "Value Not Found"

    END IF

    Return s

    End function

    Thanks

    NKM

  • You can't put THEN on its own line, it has to go after the IF.

    Aside from that, I haven't tried accessing a MVP from custom code before... are you sure GetValue is a supported function? Try putting in a placeholder string instead and seeing if the report runs or not. An alternative would be passing in the parameter as a string instead (by using JOIN() on it) and then doing a LIKE ',Vital*', keeping in mind that LIKE may be case sensitive.

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

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