<html> formatting of string in Expression Binding Perspective Label

Hi Folks,
So have an indirect tag taking a timestamp into “text” property of a label.
I am then doing a transform to put some string before/after etc, along with doing a calculation secondBetween({value},now()).
I am trying to underline some of the result using >html<>u< xxxx >/u<>/html<. (signs wrong for purpose of post, typing this in correct format is html formatting this message.
The expression sample at the bottom of the binding winding showing some underlining happen, but when i go to view on the perspective view, it shows the string complete with >html<>u< >/u<>/html< in the text.
This is something I would have used quite a but in vision on version 7.9.
However not a transform expression, just normal text bindings.

Glad for any help on how to partial format a string in an expression.

Most Perspective components do not accept HTML formatting. Depending on what exactly you are trying to do, you might be able to use the Markdown component.

1 Like

The Label component only displays values as strings, so it is taking the value output by the binding preview and wrapping it as a string.
So your binding is returning something like
2
Then your transform or formatting is outputting something like this,

<html><u> 2 </u></html>

but the preview panel is getting fooled into rendering that as if your html were being rendered by the DOM because the preview panel has no idea where that content is going; you’re still outputting the value with all of the HTML, and then the Label is doing this:

# sort of
str(<html><u> 2 </u></html>)

Which results in the Label just displaying HTML as a string.

You mean like this?
<html><u> xxxx </u></html>
The preformatted/code decorator is your friend :slight_smile:
image

1 Like

Ah ok gotcha.

<html><u>Thanks</u></html>

Ok, thanks for the feedback on this @cmallonee .
Reason I am trying to do something like this is because i want to partially format a string to be bold lets say.
so something like this.
Today is the Tuesday 19th of July.
Can’t see an easy way to do this in perspective.

I don’t think i can use the markdown component as I only want to partially format the string?
So 1 word in a sentence underlined and bold lets say.

Markdown is probably the only way to do it.
Today is the **Tuesday 19th** of **July**.
It’s similar to the markdown used in this forum’s editor.

Tip: underline is not used in professionally produced documents. Have a look at any quality newspaper, magazine or website. You won’t see underline except for hyperlinks or identifying hotkeys on window GUIs. (I can’t give an example because Markdown doesn’t support it for the reasons outlined!) Only use underline if you want the GUI to appear as though it was designed by an amateur. Note that a bottom border is different. If set up correctly it will not cut through the letter descenders and is typically the full width of the container.

css has a solution but you should use markdown if you can :stuck_out_tongue: or idk multiple labels xd

Because the css is kina hacky for this case

I’ve found underlining works well for text that either are links as in standard hyperlink practice, or I’ve also used it for underlining values that are setpoints which conveys very clearly to the operator that the value is clickable. A blanket “don’t use this” statement is a bit over the top in my opinion. However I certainly understand where you’re coming from. We’re working with a 3rd party contractor who is doing plc changes for our customer and all of his emails and his original scada screens had underlined text for absolutely everything… It is so damn hard to read. He also writes a lot of things on paper and all his text on paper is underlined with a ruler as well