Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF statement does not work as anticipated

Status
Not open for further replies.

ebell1

Technical User
Nov 10, 2010
4
US
I am new to SSRS and trying to write an IIF statement. My Crystal If Then statement is as follows:if {Field_line1} = "" then {Field_account_desc} else{Field_line1}. This works fine. In SSRS I wrote an IIF statement=iif(Fields!line1.Value = "",Fields!account_desc.Value,Fields!line1.Value). This does not work. If the line is blank then it just stays that way. I have tried IsNothing Empty IsNull DBNull and nothing seems to work. Can someone help?

 
Hi,

what control are you using? Table, matrix, tablix, textbox?

If you just have the control with =Fields!line1.Value what do you see? Do you get any results? what about =Fields!account_desc.Value?

Are any results coming back for any of the above?

Dan

----------------------------------------

Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Dr. Seuss

Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------
 
I am using a tablix. I get just the Fields!line1.Value. If the Fields!line1.Value is blank I see nothing.

I did get this to work I made the iif statement as follows:

=iif(Fields!db_bud_desc_line1.Value < "A",Fields!a_account_desc.Value,Fields!db_bud_desc_line1.Value)
 
=iif(Fields!db_bud_desc_line1.Value = NOTHING ,Fields!a_account_desc.Value,Fields!db_bud_desc_line1.Value)

SSRS way to read null value fields

-Mo

If you don't stand for something, you'll fall for anything
 
could also be trailing spaces:

=iif(trim(cstr(Fields!db_bud_desc_line1.Value)) = "" ,Fields!a_account_desc.Value,Fields!db_bud_desc_line1.Value)



Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top