SSRS / IsNothing problems

  • I'm trying to write an expression in SSRS to allow for different fields to display based on the result set. This example is for the Title line, and obviously it would be adjusted for the row containing the data.

    Objective:

    if SectionCategory is null and SectionType is null, then nothing;

    if SectionCategory is null and SectionType is not null, then "Type"'

    if SectionCategory is not null, then "Category"

    Expression:

    =switch(

    Fields!SectionCategory.Value is nothing and Fields!SectionType.Value is nothing, nothing,

    iif (Fields!SectionCategory.Value is nothing

    and (IsNothing(Fields!SectionType.Value)="No"), "Type", nothing),

    iif ((IsNothing(Fields!SectionCategory.Value)="No"), "Category", nothing)

    )

    Is it possible to nest IIF statements in a Switch statement? I've experimented several different ways and I'm getting "#Error" in Preview.

    Dana

    "Drats! Foiled again!"
  • danawexler (6/10/2013)


    I'm trying to write an expression in SSRS to allow for different fields to display based on the result set. This example is for the Title line, and obviously it would be adjusted for the row containing the data.

    Objective:

    if SectionCategory is null and SectionType is null, then nothing;

    if SectionCategory is null and SectionType is not null, then "Type"'

    if SectionCategory is not null, then "Category"

    Expression:

    =switch(

    Fields!SectionCategory.Value is nothing and Fields!SectionType.Value is nothing, nothing,

    iif (Fields!SectionCategory.Value is nothing

    and (IsNothing(Fields!SectionType.Value)="No"), "Type", nothing),

    iif ((IsNothing(Fields!SectionCategory.Value)="No"), "Category", nothing)

    )

    Is it possible to nest IIF statements in a Switch statement? I've experimented several different ways and I'm getting "#Error" in Preview.

    I don't believe that you need to use a Switch statement in this case. You should be able to achieve your goal with using just nested iif statements.

    IIF (Condition_One, NOTHING, IIF (Condition_Two, "Type", IIF (Condition_Three, "Category", NOTHING)))

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

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