# Power Table Color Cell on value in another cell

**URL:** <https://forum.inductiveautomation.com/t/power-table-color-cell-on-value-in-another-cell/14242>\
**Category:** Ignition\
**Created:** [May 9, 2017, 4:27pm UTC](https://forum.inductiveautomation.com/t/power-table-color-cell-on-value-in-another-cell/14242 "2017-05-09T16:27:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kuskah](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@Kuskah](https://forum.inductiveautomation.com/u/Kuskah)\
**Post date:** [May 9, 2017, 4:27pm UTC](https://forum.inductiveautomation.com/t/power-table-color-cell-on-value-in-another-cell/14242/1 "2017-05-09T16:27:57Z")

</div>

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?

```auto
	# 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

```auto
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.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [May 9, 2017, 4:59pm UTC](https://forum.inductiveautomation.com/t/power-table-color-cell-on-value-in-another-cell/14242/2 "2017-05-09T16:59:16Z")

</div>

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

This code works:

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

```

---

<div class="post-metadata">

**Author:** ![Kuskah](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@Kuskah](https://forum.inductiveautomation.com/u/Kuskah)\
**Post date:** [May 9, 2017, 5:26pm UTC](https://forum.inductiveautomation.com/t/power-table-color-cell-on-value-in-another-cell/14242/3 "2017-05-09T17:26:51Z")

</div>

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