Search code examples
ssrs-2008

SSRS expression - remove line breaks when field contains no data


I have an SSRS report that is a calendar, and it shows each persons different activity for each day. I currently do this via .vbcrlf to create the line break.

What I would like to do is only return a line break when there is data in the specific value.

My current expression is:

=Fields!DayOfMonth.Value 
        & Constants.vbcrlf 
        & Constants.vbcrlf 
        & Fields!Shift.Value 
        & Constants.vbcrlf 
        & Fields!OT.Value 
        & Constants.vbcrlf 
        & Fields!Holiday.Value 
        & Constants.vbcrlf 
        & Fields!AbsenceType.Value 
        & Constants.vbcrlf 
        & Fields!ClockIn.Value

So if there is no Holiday I would like to remove that line and the break meaning Absence and In/Out would move up the text box. I've tried using isNothing but cant get the syntax right.

enter image description here


Solution

  • It sees the data as NULL values, which can alter the way it treats text.

    You can use iif(isnothing(Field!Thing.Value), "", Constants.vbcrlf & Field!Thing.Value) around each one to replace null values with blanks.

    There may be a more elegant solution available.