Is it possible on a table to have the cell color decided by a value in a different column?
I’m thinking of the ‘getBackgroundAt’ function but this uses the value in the cell to be altered?
Is there any way of using this:
I have tried various things like below and failed
if col ==11 and value > self.getPropertyValue(data[selectedRow,0) :
(my SQL result has a ‘target’ value column and an ‘actual’, I want the target value to determine the ‘actual’ background color)
I think you should use the Table Customizer for this. In Ignition Designer, right-click on the Table.
If you have to have a programmatic way of changing it then you can add your own row (or update an existing one) in the table.columnAttributesData property:
Trouble is a I have 5 targets/actuals per row and therefore would have liked to have individual colors per cell. Seeing the topic regarding the reference to the ‘self’ property I thought maybe this could be possible.
Is there anyway of having a dynamic value after the comparison
if col ==2 and value < system.tag.read("Test area - delete whenever/test") :
Or is this just not possible
Actually, in 7.6 we added Extension Function (like getBackgroundAt) just so you can do that. They are in the Component Scripting under the Event Handlers.
But can this function (getBackgroundAt) reference a value that is not hard coded i.e. preferably another column value or a tag?
In the original question I had noticed someone using the ‘self.getProperty’ and wanted to know if this is a function to reference the table data in a column other than the one to be colored.
Can a tag be used after the comparison
In short, can a value OTHER THAN the value in the cell to be colored be used as the decision on what color is chosen when using the getBackgroundAt ?
If so any chance of an example as when I tried things like system.tag.read(“blah…”) it didn’t work.
Yeah, if you check out the extension function, it has some documentation in it. Namely, you get the row and column of the dataset that the cell in question refers to. With that, you can get another value using something like this:
from java.awt import Color
if self.data.getValueAt(row,0) > 15: