Power Table Color Cell on value in another cell

Hey all,

Looking for some help here. Trying to set the background color of a cell based upon the cell next to it. When running the code below in the configureCell extension, it colors the entire column. Where did I go wrong?

	# Configure the Size Column
	if colName == 'Size':
		for num in range(0,self.data.rowCount,1):
			if str(self.data.getValueAt(num,0)) != "":
				return {'background': '191,191,191'}	

When I changed the return line to

print str(self.data.getValueAt(num,0))	

then I can see the code iterating through the dataset and printing the cells that were not blank. So I am confused as to what I did wrong.

Thanks in advance.

You are iterating over the rows when you don’t need to do that.

This code works:

	if colName == 'Size':
		if str(self.data.getValueAt(rowIndex,0)) != "":
				return {'background': '191,191,191'}

Thank you nmudge. I just realized what I was doing wrong.