Creating a combined IIF statement in a field expression

  • Hello,

    I have a field on my SRS Report called new_Region. I prompt the user to enter a value from 1-4. I need the new_Region field on my report to display the text below.

    1 means "West"

    2 means "Central"

    3 means "East"

    4 means "Atlantic"

    So I tried creating this IIF statement, but I don't know

    how to group it so that it works properly. Right now I'm

    getting a #Error displaying in the field.

    IIF (Fields!new_Region.Value=1, "West", "")

    IIF (Fields!new_Region.Value=2, "Central", "")

    IIF (Fields!new_Region.Value=3, "East", "")

    IIF (Fields!new_Region.Value=4, "Atlantic", "")

    Thanks

  • replace iif with select case....

  • alternatively, nest the four IIF statements inside each other, so that the "false" part of the first IIF, contains the next IIF statement

    for example:

    IIF (Fields!new_Region.Value=1, "West", IIF (Fields!new_Region.Value=2, "Central", ""))

    but the CASE method makes for much easier reading / debugging! 🙂

  • Try the Switch function:

    =SWITCH(Fields!new_Region.Value=1, "West",

    Fields!new_Region.Value=2, "Central",

    Fields!new_Region.Value=3, "East",

    Fields!new_Region.Value=4, "Atlantic")

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

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