iif(isnothing not working

  • I am trying to write an expression like this =iif(isnothing(Fields!ProdCode.Value), "No Product Code", "Product Code is: ", (Fields!ProdCode.Value)).

    Whenever I do this it doesn't seem to show the """Product Code is: """ part. I am still pretty new to SSRS and any help would be appreciated.

  • Not sure exactly what you're evaluating, but looks to me like you have four arguments in the IIf() function, when it only accepts three.

    ---------------------------------------------------------
    How best to post your question[/url]
    How to post performance problems[/url]
    Tally Table:What it is and how it replaces a loop[/url]

    "stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."

  • I basically just want to show "Product code is: " (Fields!ProdCode.Value) if there is one and iif(isnothing(Fields!ProdCode.Value), "No Product Code".

    So if you can't do this in a iif statement what is a way to do so.

  • I wasn't saying it can't be done, I was saying you're doing it incorrectly.

    IIf() works off of three values, Test, True and False. You're feeding in a fourth value, which it doesn't know what to do with. I think you are trying to concatenate, and just missing it by using a comma, which makes it a fourth value

    example:

    Your code:

    =iif(isnothing(Fields!ProdCode.Value), "No Product Code", "Product Code is: ", (Fields!ProdCode.Value)).

    Test = isnothing(Fields!ProdCode.Value)

    True = "No Product Code"

    False = "Product Code is: "

    fourth value = (Fields!ProdCode.Value)

    Should be (based on your last post):

    =iif(isnothing(Fields!ProdCode.Value), "No Product Code", "Product Code is: " & Fields!ProdCode.Value)

    Test = isnothing(Fields!ProdCode.Value)

    True = "No Product Code"

    False = "Product Code is: " & Fields!ProdCode.Value

    The ampersand (&) allows you to concatenate the ProdCode.Value and the string "Product Code is: "

    Hope that helps,

    Jon

    ---------------------------------------------------------
    How best to post your question[/url]
    How to post performance problems[/url]
    Tally Table:What it is and how it replaces a loop[/url]

    "stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."

Viewing 4 posts - 1 through 3 (of 3 total)

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