SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSRS / IsNothing problems


SSRS / IsNothing problems

Author
Message
danawexler
danawexler
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 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!"
jkassay
jkassay
Grasshopper
Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)

Group: General Forum Members
Points: 23 Visits: 115
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)))
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search