Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SSRS / IsNothing problems Expand / Collapse
Author
Message
Posted Monday, June 10, 2013 3:57 PM


SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, November 18, 2013 4:48 PM
Points: 46, Visits: 113
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!"
Post #1461793
Posted Wednesday, June 26, 2013 3:06 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, December 9, 2014 8:44 AM
Points: 23, Visits: 114
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)))
Post #1467884
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse