Showing posts with label textbox in report. Show all posts
Showing posts with label textbox in report. Show all posts

Sunday, December 16, 2012

Display more than 2000 characters in SSRS report


We would like to share one of our experiences with SSRS reports. One of the reports we were building required displaying of notes that could hold more than 2000 characters.
 
 Including a text box worked fine for most of the records but we observed that the ones that had more than 2000 characters reported error. To show the entire content of the notes in SSRS reports you can try the following workaround:
 
Add a textbox with the following expression

 =IIF(Len(Fields!description.Value) >= 2000,Left(Fields!description.Value,2000) ,Left(Fields!description.Value,2000))
 
This will show the first 2000 characters.
 
For the next 2000 add a blank row and include a textbox with the following expression
 
=IIF(Len(Fields!description.Value) >= 2000, cstr(Fields!description.Value).Substring(2000), "")
 
If the content included is less than 2000 characters in the first place itself, then to hide the blank row add the following expression to the visible property
 
=IIF(Len(ReportItems!txtDescription.Value) >= 2000,false,true)
 
Note ReportItems!txtDescription refers to the same textbox that we are hiding
 
This way we were able to increase the display limit to 4000 characters to increase it further add another text by using the same logic as above.

 
Hope this helps!