SSRS - Control Line Wrap

So we built a new BAQ report using the knowledge base on E10 to concatenate detail rows in a BAQ to a single delimited field… This ended working out very well and we have the data normalized the way we want it before passing it to SSRS.

But we have one small nuance that we would like we would like to see if we can work out.

Is it possible to control when the line wraps in the textbox that the string is tied to is SSRS?

The individual pieces of data (between the commas) can be all different sizes and the string itself overall will vary. But we do not want the data to wrap and break up a single string between commas. We would only want the line to wrap after a comma. Hope this makes sense

This is just an idea, untested.

Many text controls will naturally wrap at whitespace. If there is no whitespace available, it wraps where it has to. If it is possible to replace the commas with comma-space, it may wrap where you want it to.

2 Likes

Ahhh, so simple… rookie oversight.

Thanks,
Andrew

I use this function in Report Properties /Code where i pass the text to appear in the textbox…

Public Function SplitComments(ByVal str As String) as String
Dim c() As String = Nothing
dim s as string = ""
c = str.Split(vbcrlf)
Dim i As Integer
For i = 0 To c.Length - 1
If i > 0 Then
s = s & vbCrLf & c(i)
Else
s = c(i)
End If 
Next
return s
End Function

and call it as an expression for example
=Code.SplitComments(First(Fields!ShipComment.Value, “ShipHeadShipDtl”))

2 Likes

What does this code do? It looks like you take a string with embedded CRLF’s and break it as those points. Then join them together with a CRLF.

What input of str would be different from the returned value of s ?

helloCRLFworld

would make c = ['hello','world'], with length of c equal to 2.

After the first pass (i=0) through the For loop:
s = 'hello'
and after the second
s = 'helloCRLFworld'

Well first, I did not create this code, i was told to use it…;). All I know is my comments text went from being linear (no line breaks ) to be using the valid line breaks originally intended. If I copied the text from within DB table record field to notepad, it showed correctly. But added to a SSRS report text box, it did not…Using this function does the split!

But I see what you mean (my VB is soo far away… ) looking at it…but it does split the comments! Just did a test with and then without and the text shows as expected with the code, and will not show with line breaks without!

Pierre

2 Likes

I’ll just pass it off as SSRS magic. :wink:

2 Likes

Ah, so it finds the line-feeds in the output from Epicor and breaks the string accordingly. Similar to a List view in how “Copy to Excel” will carry over the line breaks but how “Copy All” or “Copy All Include Labels” will not carry over the line feeds when pasted into Excel.

:mage: indeed!

1 Like

by replacing them with the very same thing that was removed… :thinking:

(I mean it’s not replacing just an LF with a CRLF, or even a LFCR with CRLF …)

Well, it’s replacing: vbcrlf with: vbCrLf

Remember that C# is case sensitive, so I chalked it up to the export stripping the case out of the command and C# thus ignoring it. That’s just my guess

And …

For i = 0 To c.Length - 1 
  If i > 0 Then 
    s = s & vbCrLf & c(i) 
  Else 
    s = c(i) 
  End If 
Next

All that is C# ?? :wink:

Well, true, I’m just used to thinking all code for Epicor is C# I guess. LOL

Here is another workaround. It involved changing the express for multiline fields.
Here is the code:
=IIf(InStr((Replace(Fields!FIELDNAME.Value, CHR(10), “CHR10”)), “CHR10”) > 0 AND InStr((Replace(Fields!FIELDNAME.Value, CHR(13), “CHR13”)), “CHR13”) = 0,

Replace(Fields!FIELDNAME.Value, CHR(10), vbcrlf),

IIf(InStr((Replace(Fields!FIELDNAME.Value, CHR(10), “CHR10”)), “CHR10”) = 0 AND InStr((Replace(Fields!FIELDNAME.Value, CHR(13), “CHR13”)), “CHR13”) > 0,

Replace(Fields!FIELDNAME.Value, CHR(13), vbcrlf),

Replace(Replace(Fields!FIELDNAME.Value, CHR(10),””), CHR(13), vbcrlf)))

Full link is here:
How To Keep Formatting In SSRS from Epicor 10 Character Fields? | Toolbox Tech