Scripting Cell color in a Power Table

Hello All,

I am having a hard time coming up with a proper script and integrating it and wanted some guide.
I have a power table and have four custom properties binded to it.
Snap9

First, I wanted to highlight a single cell in the third column based on the PartName.
Snap8

But the script I am using highlights the whole row.

if self.PartName == self.data.getValueAt(rowIndex, "Seed Tube Part Number"):
		return {'background': 'Green', 'foreground': 'white'}
	else:
		pass

Also, if the Current program number matches any data in the first column and the Pass property is true, I want to highlight that particular cell as well. I don't know how to write a program for this part and integrate with the first script. Any help would be greatly appreciated. Thanks.

Something like this should do it.

This

    else:
        pass

is not necessary.

attributes = {'background': 'White', 'foreground': 'Black'}
if self.PartName == self.data.getValueAt(rowIndex, "Seed Tube Part Number"):
        attributes['background'] =  'Green'
        attributes['foreground'] = 'White'
if colName == "Int Column" and value == self.CurrentProgramNumber:
        attributes['background'] =  'Yellow'
        attributes['foreground'] = 'Black'

return attributes
1 Like