Dean Flaherty Dean Flaherty - 3 months ago 11
SQL Question

SSRS - Line break in Matrix cell

In a SSRS Matrix cell I want to be able to have a line break between each output given.

I have the following code in my MS SQL Server Stored Procedure which I then point my SSRS report to

SELECT Customer, Hostname, (QName + QHostname + Qtag + QSerial + QCategory + QType + QItem + QManu + QModel + QVersion) AS AdditionalInfo1
FROM TableQ


At the moment in the AdditionalInfo1 cell when one of the options is returned they are separated by a comma

e.g.

QName, QHostname, Qtag.

Instead I would like them to be separated by a line break all within the same cell

e.g.

QName

QHostname

Qtag

I have tried putting + char(13) + between each Q... in AdditionalInfo1 but this didn't work.

Answer

For SSRS, you want to use Chr(10), not Chr(13). I've used this in expressions and as a Join delimiter argument and it produced the desired effect: line breaks within the textbox.

Edit:

Below is an expression that will return an empty string if the field value (QHostName) is null, or the value preceded by a newline if it is not.

IIF(ISNOTHING(Fields!QHostname.Value),"", vbCrLf + Fields!IQHostname.Value)