0

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.

2boolORNOT2bool
  • 557
  • 3
  • 9
  • 23

2 Answers2

1

you can try

=IIF(First(Fields!AddressLine2.Value, "dsPersonData") is Nothing ,False,True)
Mr.Wizard
  • 24,179
  • 5
  • 44
  • 125
Opabid
  • 11
  • 1
0

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)

Marco Hurtado
  • 534
  • 3
  • 13