IIF Expression in SSRS 2008R2

605 views Asked by At

I have written an IIF statement:

=IIF(fields!addressline1.Value< ",", "No Details", Fields!addressline1.Value)

This works fine in that it returns 'no details' if the addressline1 value is blank. However, I would also like to add fields!postcode.value to the initial argument, something like:

=IIF(fields!addressline1.Value AND fields!postcode.value < ",", "No Details", Fields!addressline1.Value) - but this isn't working.

Any suggestions would be much appreciated - thanks.

1

There are 1 answers

1
Dan Scally On BEST ANSWER

You just need to specify the "is blank" bit for each part of the And;

=Iif(fields!addressline1.Value <"," And fields!postcode.value < ",", "No Details", Fields!addressline1.Value)

As an aside, "less than a comma" is a super weird way of saying "is blank". I would expect IsNothing() to be used, so:

=Iif(IsNothing(fields!addressline1.Value) And IsNothing(fields!postcode.value), "No Details", Fields!addressline1.Value)

Of course if your way works, then I wouldn't worry.