# Perspective table, changing row color

**URL:** <https://forum.inductiveautomation.com/t/perspective-table-changing-row-color/62126>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [July 20, 2022, 2:48pm UTC](https://forum.inductiveautomation.com/t/perspective-table-changing-row-color/62126 "2022-07-20T14:48:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [July 20, 2022, 2:48pm UTC](https://forum.inductiveautomation.com/t/perspective-table-changing-row-color/62126/1 "2022-07-20T14:48:27Z")

</div>

I have added a “isAccountedFor” column in a table:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/c/ec1dcd1fb56332eedffd6d91477c525fdd986dba.png)  
Using this script:

```auto
	table = self.getSibling("Table_0").props.data
	accounted_badge_num = [B['Badge_Num'] for B in table]
	json_obj = []
	for V in value:
		py_dic = dict(V)
		if py_dic['BadgeNum'] in accounted_badge_num:
			py_dic['isAccountedFor'] = True
		else:
			py_dic['isAccountedFor'] = False
		json_obj.append(py_dic)

			
	return json_obj

```

How can I get the row count and single out the “isAccountedFor” == True for color change?  
Should I add another transform or do it in this transform?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [July 20, 2022, 3:01pm UTC](https://forum.inductiveautomation.com/t/perspective-table-changing-row-color/62126/2 "2022-07-20T15:01:49Z")

</div>

if you put the data in value you can add a style object too

instead of

```auto
data[{"Badge_Num":5,"isAccountedFor"...},...]

```

somethingk like

```auto
data[{"value":{"Badge_Num":5,"isAccountedFor"...},"style":{"backgroundColor":"red"}}...]

```

```auto
	#table should not be here? you should not get data from the table props thou
	table = self.getSibling("Table_0").props.data
	accounted_badge_num = [B['Badge_Num'] for B in table]
	json_obj = []
	for V in value:
		py_dic = {"value":dict(V)}
		if py_dic["value"]['BadgeNum'] in accounted_badge_num:
			py_dic["value"]['isAccountedFor'] = True
			py_dic["style"]={"backgroundColor":"red"}
		else:
			py_dic["value"]['isAccountedFor'] = False
		json_obj.append(py_dic)

			
	return json_obj

```

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [July 20, 2022, 3:08pm UTC](https://forum.inductiveautomation.com/t/perspective-table-changing-row-color/62126/3 "2022-07-20T15:08:35Z")

</div>

hmm, i see. that helps alot. I am still trying to get the hang of everything.
