2boolORNOT2bool
2boolORNOT2bool

Reputation: 567

SSRS 2008 R2 Remove White Space if Null

I have a simple SQL Server 2008 R2 report with a textbox containing a few fields. I want to suppress the line if the value of a field is null. What would be the syntax for the expression?

So my fields are...

Name
AddressLine1
AddressLine2
AddressLine3
CityStateZip

and I have expressions like this...

=First(Fields!AddressLine2.Value, "dsPersonData")

I was trying the expression below but getting errors

=IIF(Fields!AddressLine2.Value, "",True,False)

In other words I was trying to set the visibility to false if the value was an empty string but I'm not sure what the syntax would be.

Upvotes: 0

Views: 2606

Answers (2)

Opabid
Opabid

Reputation: 11

you can try

=IIF(First(Fields!AddressLine2.Value, "dsPersonData") is Nothing ,False,True)

Upvotes: 1

Marco Hurtado
Marco Hurtado

Reputation: 534

Is easy to do this in the sql query, For example:

in SQL Server:

ISNULL(Name, '') as Name
ISNULL(AdressLine1, '') as AdressLine1
ISNULL(AdressLine2, '') as AdressLine2
ISNULL(AdressLine3, '') as AdressLine3
ISNULL(CityStateZip, '') as CityStateZip

and if you want to set the visibility to false:
=IIF(First(Fields!AddressLine2.Value, "dsPersonData") = "",False,True)

Upvotes: 0

Related Questions