Solved

Invalid characters in my SSRS report

Posted on 2010-11-23
15
779 Views
Last Modified: 2012-05-10
I am getting "<" and >" being displayed in my report. How can I get rid of these characters?
0
Comment
Question by:g46905
  • 6
  • 4
  • 3
  • +2
15 Comments
 
LVL 4

Expert Comment

by:BostonMA
ID: 34198929
Can you provide more detail such as a screenshot or what sql is used to retreive these fields?  
0
 

Author Comment

by:g46905
ID: 34199933
Below is the field that I am using for the field. Can I use trim functionality and replace the unvalid characters?
Fields!ows_COMMENTS.Value
0
 
LVL 27

Expert Comment

by:planocz
ID: 34202052
Is this info that you are retreiving from the sql table from a html or asp page?
0
 

Author Comment

by:g46905
ID: 34206229
Genious - I am not sure what you are asking. I am retreiving this information from SQL database and displaying it onto my SSRS report. Can you please elaborate what you are asking. Thanks for your help!

0
 
LVL 27

Accepted Solution

by:
planocz earned 500 total points
ID: 34206663
these symbols are comes from a internet display, either from the in coming data that is being stored in the sql database or isomehow in your report.
You might try this in the visitly hide properties of the comment box....
=IF (Trim(Fields!ows_COMMENTS.Value) = "",True,False)
0
 

Author Comment

by:g46905
ID: 34206733
planocz - Unfortunately. that did not work....
0
 

Author Comment

by:g46905
ID: 34208901
This is what I see for one of the text fields in the reports.....

<html><body><font color="#000080"><b>Susan <sms>, 5/10/2007: </b></font> Per a message from John today, "the headings will remain as is."</body></html>
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 21

Expert Comment

by:Alfred1
ID: 34210530
You can try doing this:

Replace(Replace(Fields!ows_COMMENTS.Value,"&lt;","<"),"&gt;",">")
0
 
LVL 21

Expert Comment

by:Alfred1
ID: 34210542
Or, with ampersand and quotes

Replace(Replace(Replace(Replace(Fields!ows_COMMENTS.Value,"&lt;","<"),"&gt;",">"),"&amp;","&"),"quot;","""")
0
 
LVL 27

Assisted Solution

by:planocz
planocz earned 500 total points
ID: 34213554
Ok try this in your code tab properties box
  Public Function CleanHtml(ByVal theText As String) As String
        theText = System.Text.RegularExpressions.Regex.Replace(theText, "b&gt;|&lt;|html|&gt;|&lt;|body|/body&gt;|gt;|&lt;|lt;|font color=|#[0-9]{1,6}|&quot;|quot;|&amp;|sms&amp;", "")
        theText = System.Text.RegularExpressions.Regex.Replace(theText, "/b&gt;|/font|/+[a-z]{1,4}", "")
        theText = System.Text.RegularExpressions.Regex.Replace(theText, "\.+/", ".")
        Return theText
    End Function

On the report use this type of code in the textbox for each data that you want to change.
=code.CleanHtml(fields!ows_COMMENTS.Value)

Also if I missed a char you can adjust it in the function code.
0
 
LVL 3

Expert Comment

by:GSGDBA
ID: 34219269
HI,
If you have < and > signs in your code.
Try to remove them

see the below link what &lt;" and &gt;  means
http://www.velocityreviews.com/forums/t160903-what-are-these-characters-and-lt.html
0
 

Author Comment

by:g46905
ID: 34248979
Alfred1 - By using your function above, I am able to convery &lt and &gt to '<' and '>'. Unfortunately, now I see below happening.....any suggestions to get rid of this issue??

<html><body><font
color=&quot;#000080&quot;><b>Lisa Jones &amp;lt;lisa&amp;gt;,5/10/2007: </b></font>message from David today,&amp;quot;the heading will remain as is.&amp;quot;</body></html>

0
 

Author Comment

by:g46905
ID: 34249293
planocz: - How can I get to "code tab properties box" ?
0
 
LVL 27

Expert Comment

by:planocz
ID: 34254071
should be on the body of the report just right click and view the window then click on the code tab and enter the code
0
 
LVL 21

Expert Comment

by:Alfred1
ID: 34254158
Try this one:

Replace(Replace(Replace(Replace(Fields!ows_COMMENTS.Value,"&lt;","<"),"&gt;",">"),"&amp;quot;",""""),"&quot;","""")
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by Valentino Vranken. A while ago I wrote an article called Chart Optimization Tips (http://www.experts-exchange.com/articles/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Chart-Optimization-Tips.html).  This article explained how …
Steps to solve SSRS SQL 2008 R2 User Access Control (UAC) Permission Error With the introduction of SQL Server 2008 R2 and Vista (Windows 7 as well) came new enhanced security features. One of the features included was User Access Control (UAC) t…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now