2

I have a field with multiple words in it. I want to separate the words onto different lines rather than have them separated by spaces.

So for example “Not Great”, I want to put “Not” on 1st line and “Great” on 2nd line, like so:

Not
Great

There could be words with “/” character in between i.e. “Great / Good” where I want to put everything after 1st word in 2nd line and everything after “/” in 3rd line i.e.

Great 
/
Good 

Basically, whenever there is space, I want split that string into multiple lines. How do I do that in SSRS?

Chris Latta
  • 20,316
  • 4
  • 62
  • 70
007
  • 2,136
  • 4
  • 26
  • 46
  • Could you edit and improve the question? A spell check, some more [formatting](http://stackoverflow.com/editing-help) to make the examples readable (it's a bit of a "wall of text" at the moment), and most importantly some info on what you've tried so far would be great! – Jeroen Nov 21 '12 at 18:37

3 Answers3

2

Ok, you want the string broken up into different lines. Do you mean on separate lines within the same tablix cell?

Thats straightfoward see http://www.kodyaz.com/articles/reporting-services-add-line-break-between-words-custom-code.aspx

If you mean to split the string so the words are on different Tablix cells one approach would be to use a sub report on a list.

Set the list data set to the original data set containing the multiple word string, pass the string to the sub report as a parameter. On the sub report pass the parameter to a data set that splits the string into individual lines. Losts of suggestions for how to do that here Turning a Comma Separated string into individual rows

Community
  • 1
  • 1
David Lawson
  • 796
  • 3
  • 10
1

Simply replace the space with a carriage return and line feed:

=Replace(Fields!SomeWords.Value, " ", vbCrLf)
Chris Latta
  • 20,316
  • 4
  • 62
  • 70
1

=Fields!SomeFields.Value.Replace(Space(1), vbCrLf)

veljasije
  • 6,722
  • 12
  • 48
  • 79