Icon Replacing Int value in Table

I have a Power Table that returns a set of Integers, Strings, and Datetime values. I would like to replace one of the values with an icon, based upon the value of an integer. The script runs because I also alternate the colors of the rows, and that works. I get no error messages.

Any thoughts?

This is the code I am using


 	if colName == "IG_Alarm_Icon":
		if value == 1:
			return {"iconPath" :  "Builtin/icons/16/Red_Bell.png", "text" : ""}

Without seeing your full script I would guess that your alternate row coloring script comes before the block that you posted and it’s causing the IG_Alarm_Icon column script to not be executed.

In your row coloring script you have a return statement right? The return statement ends the configueCell function so the rest of your script isn’t run.

See this post for a method of handling multiple cell configuration items.

JGJohnson, Yes, I do indeed have a return statement after the row coloring script. Thank you for the link.

Print statements.
The most likely cause is that your clause isn’t being met. Print after both if statements to check whether they’re actually being met. Try printing the value to see if it’s actually what you expect.

I truly did not intend to post this question twice. I will try JGJohnson’s suggestion, and this if I still don’t get it to work.

1 Like

Is there any way to change the image size when returning it for use in the table, or will it use the size of the icon?

If you use the iconPath return key, it’s hardcoded to 24x24px. You’d have to implement your own renderer if you want different behavior.