HTML formatting in a Power Table not working

I have a column in a power table that I want to conditionally format based on if another column is null or not. In my query, I have the following, which I thought would have done the trick

if(m.attachment IS NULL,m.text, CONCAT("<HTML><u>",m.attachment,"</u><br>", m.text)) as 'text',

but I am just getting the following -

image

Where I want the C:\Users\Admin… to be underlined. Why is this not working/how can I make it work? I’d like to keep the logic in my query if possible for speed purposes.

I also tried using the configure cell route here to try to accomplish the same but to no avail

if colName == "text":
	attachment = data.getValueAt(rowIndex, 'attachment')
	text = data.getValueAt(rowIndex, 'text')
	if attachment is not None:
		newText = "<HTML><u>"+attachment+"</u><br>" + text
		return {'text': newText}

this visually shows up the same as my first picture.

I think that I understand what you have been saying, and need to preface this with: The forums are not the same as SUPPORT- which you can also access ( PTurmel reminded me about this, and you may want to look at the Support Policies first ). That said:
It seems that you are undecided about the use of the script term for Nothing at All, yet maybe ( and this is just an educated guess ) - You could try “” ( double quotes with nothing in between ) or “_” with underline in between yet only IF those table values had been pre-formatted with the Nothing at All type of content. That said, you might have to start with the same size table and over-write it with your Contains something type of Data to get the result you want. This is the ‘fix’ I have used with a .CSV table, yet the data delimiters in various Databases (SQLs) can vary. So again, maybe try “” or just 0 ( Zero) instead of the word Null or None. If that fails, try an e-mail to support.

I think I was not clear about what I need this to do. My database table has two columns, text which are the contents of a message and attachment which is the path to an attachment, if there is one. For rows that only have message content, I would just like to display that as is. For rows that have a message and an attachment, I want a it to look like Message Content Here Attachment, I just want to be able to bold a part of the text inside a power table.

Are you saying the cells though are either all bold or all unbolded? If that’s the case that’s fine, then what I am attempting is impossible and I can try something else.

Where would I find the support forum/website and how/why is this question more appropriate for there and not here?

if colName == "text":
	attachment = data.getValueAt(rowIndex, 'attachment')
	text = data.getValueAt(rowIndex, 'text')
	if attachment is not None:
		newText = "<HTML><u>attachment:</u><br><b>" + textValue + "</b>"
		return {'text': newText}

I tried that initially and this is what appears in my power table cell

image

Is there some initial set up for the power table I am supposed to do to allow it to parse <HTML> or something?

https://support.inductiveautomation.com is the link ( HTTPS colon forwardslash forwardslash SUPPORT dot INDUCTIVEAUTOMATION dot COM where capitalized letters are actually lower case and punctuation is spelled out in lower case should there be an issue with cut and paste Ctrl-C, Ctrl-V type of operation ) . The support policies depend on your account, and you may note that non-priority e-mail is free. That said, I am no expert- yet have noted that often the NULL or NOTHING in there can be detected by means of empty quotes or determination with an ASCII conversion to establish an EMPTY cell. Using interpretive basic, the command CHR$(xx) lookup in the help menu got me on the right track for detecting that absence of data. A returned value of zero can help in some cases, yet zero can be an important inventory number also. Since your column should not contain the actual number zero, the machine might decide that lack of any data equates to zero if it is empty.

This worked for me.

	if colName == "text":
		attachment = self.data.getValueAt(rowIndex, 'attachment')
		newText = "<html><u>%s</u> %s</html>" % (attachment, textValue)
		return {"text": newText}

Didn’t work :frowning:

image

I am using Ignition 7.9.1. I’m not sure if this was perhaps introduced after.

Check the table properties (ie, the Column Attributes dataset) - do you have ‘Wrap Text’ enabled? Try toggling it off.

2 Likes

Disabling wrap text does get rid of the <HTML> so it is now trying to parse the the HTML and I see it correctly when I view the dataset, nice!

However, now my rows are only one line height tall and don’t seem to be responsive to the amounts of text like they were with wrap text on. Any way I can fix that?

Before -
image

and after-

image

I already have Auto Row Height as True.

Here’s my query, is there some tag I can add to make it wrap?

IF(m.attachment is NULL, CONCAT("<HTML>",m.text,"</HTML>"), CONCAT("<HTML>",m.text, ", <b>", m.attachment,"</b></HTML>")) as text