Reputation: 93
I've created an SSRS report to print per address.
I am using vbcrlf to concatenate multiple fields in one text box.
On some occurrences, one of the fields with in the concatenate might be null. If this is the case, the line returned creates a blank line within my textbox.
Is there a way to remove the blank line break?
=Fields!SOP10200_ADDRESS1.Value & vbcrlf & Fields!SOP10200_ADDRESS2.Value & vbcrlf & TRIM(Fields!SOP10200_CITY.Value) & "," & TRIM(Fields!SOP10200_STATE.Value) & " " & TRIM(Fields!SOP10200_ZIPCODE.Value)
Expected Results:
4349 Green Ash Dr.
Earth City,MO 63045
Actual Results:
4349 Green Ash Dr.
Earth City,MO 63045
Upvotes: 1
Views: 671
Reputation: 93
Thank you Hannover. I had to change it slightly and then it worked!
=Fields!SOP10200_ADDRESS1.Value & vbcrlf &
IIF(ISNOTHING(Fields!SOP10200_ADDRESS2.Value)
OR Fields!SOP10200_ADDRESS2.Value = "",vbcrlf,"")
& TRIM(Fields!SOP10200_CITY.Value) & "," & TRIM(Fields!SOP10200_STATE.Value)
& " " & TRIM(Fields!SOP10200_ZIPCODE.Value)
Upvotes: 0
Reputation: 10860
I would add in an IIF statement to check the Address 2 field to make sure it's not NULL or blank. If it is blank or null then have a blank otherwise out in the VBCRLF.
IIF(ISNOTHING(Fields!SOP10200_ADDRESS2.Value) OR Fields!SOP10200_ADDRESS2.Value = "", "", VBCRLF)
So your expression would be
=Fields!SOP10200_ADDRESS1.Value & vbcrlf &
Fields!SOP10200_ADDRESS2.Value &
IIF(ISNOTHING(Fields!SOP10200_ADDRESS2.Value)
OR Fields!SOP10200_ADDRESS2.Value = "", "", VBCRLF) &
TRIM(Fields!SOP10200_CITY.Value) & "," &
TRIM(Fields!SOP10200_STATE.Value) & " " &
TRIM(Fields!SOP10200_ZIPCODE.Value)
Upvotes: 2