SSRS how to render HTML escaped character - reporting-services

I am trying to render a column which has lots of HTML escaped characters, such as &#0945 for alpha, &#0946 for beta. I use SSRS 2012's placeholder property to render it as HTML markup type. This feature looks like only works with HMTL tags, not escaped characters.
Any feedback appreciated.

Right-click on the non-design surface of your report and click Report Properties.... Click the References option, click Add in Add or remove assemblies and add System.Web from the .NET options.
Click the Code option and add the following code:
Function Decode(ByVal EncodedString AS String) AS String
Return System.Web.HttpUtility.HTMLDecode(EncodedString)
End Function
For your field value, use the expression:
=Code.Decode(Fields!MyField.Value)

Related

replace all selected json objects with a different object

I am using visual studio code Version 1.19.3, and I have 174 occurrences of a specific json object which I would like to replace with a different object. Is there an easy way to do this in visual studio code? find and replace doesn't work because of the tabs.
You can search and replace tabs in vscode but perhaps you have your tabs converted to spaces as your default indentation. If you try Ctrl-Shift-P and "Convert Indentation to Tabs" then search and replace for \t will work as you expect (with the Use Regular Expression button clicked).
Then you could back to indentation with spaces by Ctrl-Shift-P and "Convert Indentation to Spaces" if you wish when you are done.

Add a link to Netsuite transaction with custom body field

We have a need for an additional ADVANCED PDF/HTML printing template in Netsuite. Also, we are currently unable to add an extra print action using scripting (I know this would be the simple solution, and hopefully in time we will be able to do this)
I want to know if it is possible by using a CUSTOM BODY FIELD, and using the formula/default values.
I currently have a custom field setup, using the following formula, however when I open the transaction I get a ERROR: Invalid Expression
<a https://system.eu2.netsuite.com/app/accounting/print/hotprint.nl?regular=T&sethotprinter=T&template=131&id='||{salesorder.internalid}||'&label=Picking+Ticket&printtype=pickingticket&trantype=salesord>PRINT</a>
The formula is invalid because it is missing the opening and closing quotation marks around the string literal.
I've also added the missing href attribute and HTML quote marks, and changed the URL to be relative so the link is valid across data centers and enviroments.
'PRINT'

When should variables be quoted in GTM custom html tag?

I am trying to implement facebook pixel via GTM, and I am hitting a few oddities.
I am implementing via custom html tag, and If i dont quote the variables, the gtm debugger shows them as google_tag_manager["<ID>"].macro(\'gtm123123123\')in the debugger, instead of the value itself. If i surround the use of the variable with quotes, I see the value itself.
If the {{User Email}} is translated into javascript code as i am seeing, I presume quoting isnt required?
If I need to quote, how would I write code like? em: ({{User Email}} || "").toLowerCase(),
Which is recommended? How to decide?
Also the debugger surrounds the entire tag in a '' is this expected?
In Custom HTML Tags you reference your Variables with the double brackets as per your example, without the quotes. e.g.
var userEmail = {{User Email}};
The Preview Mode Debug Panel is showing a non-executed version of your Custom HTML Tag. So the '' wrapped around your script in the panel output is expected. This is also why your Variables are not showing as values, instead you are seeing the internal GTM reference to your Variable.
If you need to test your Variable you can temporarily include a console.log(); To ensure your values is resolving correctly. e.g.
var userEmail = {{User Email}};
console.log(userEmail);

Django CMS: Custom plugin preview in editor escaping some characters

I made a custom plugin for Django CMS, and as is the default behavior, the preview icon of the text field showed the returned value of the model's __unicode__(self) as the icon in the WYSIWYG view of the editor:
(where "Email address" is the name of the custom plugin.) However, if the __unicode__(self) method of the plugin returns anything with characters such as ', &, or < >, they get escaped in the preview:
I'm pretty sure the preview uses the alt text property of the plugin instance. The closest thing to people having the same issue I can find is this report, as well as this suggested fix, but neither solution causes any change in the alt text behavior, as far as I can tell.
Basically, even though the plugin's output on the actual page isn't affected, I'd like to be able to display characters like ', &, <, and >in the editor preview. Is this possible?
Try to use mark output as safe using django helper method.
Example:
from django.utils.safestring import mark_safe
...
def __unicode__(self):
... do stuff ...
return mark_safe(output)

How can I remove or escape new line-carriage returns within an XML string in XSL?

I've got an ASP multiline textbox that saves user defined text to a database. When I retrieve the data, I serialize it into xml and then run it through an XSL transform to output my HTML.
Within my transform, I am passing the textbox defined data into a javascript function via an onclick event of an element.
The problem I'm running into...when a user enters a carriage return into the textbox and saves it to the database, a javascript error is generated on page load.
I'm using .NET's XslCompiledTransform to do the transform. There is a property on XmlDocument called PreserveWhiteSpace, default is false, that can be set to strip out white space in the XML. This solves the problem of not allowing a user to enter breaking text, however, the client wants to preserve the formatting of the text that they enter if at all possible.
From what I know, .NET XslCompiledTransform transforms carriage returns-new line into
. I believe these are the characters that are breaking the javascript.
My first thought was to strip out the carriage returns within the xsl prior to passing the string into the javascript function, but I've not been able to figure out what characters to "search" the string for.
I guess another question is what characters get stored in SQL for carriage returns from within an ASP.NET textbox control?
Looking directly at the data in the database, SQL seems to display the character as "non-displayable" characters or (2 empty boxes).
Has anyone had any experience with this type of thing?
I was able to do this in the code behind to get my desired results:
using (StringWriter sWriter = new StringWriter())
{
xTrans.Transform(xDoc, xslArgs, sWriter);
return sWriter.ToString().Replace("
", "\\r\\n");
}
One other thing that I've stumbled across...
Initially, I wanted to find a solution to this problem that did not require a "compiled" code change, ie. a way to do this within xsl aka "a short term fix".
I tried this first and was not successful...
<xsl:variable name="comment" select="normalize-space(.\Comment)" />
This essentially did nothing and I was still receiving the javascript error.
Eventually, I tried this...
<div onclick="Show('{normalize-space($comment)}'"></div>
The second actually worked in stripping out the white space, thus, the javascript error was avoided. This wasn't a complete solution for my requirements because it only solved the issue of the javascript error, however, it would effectively prevent the user from "breaking" the page.
For that reason, it could suffice as a short term solution.