# How to find a character in a cell?

**URL:** <https://forum.inductiveautomation.com/t/how-to-find-a-character-in-a-cell/38370>\
**Category:** Ignition\
**Created:** [September 3, 2020, 8:31pm UTC](https://forum.inductiveautomation.com/t/how-to-find-a-character-in-a-cell/38370 "2020-09-03T20:31:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Icom](https://avatars.discourse-cdn.com/v4/letter/i/e68b1a/32.png) [@Icom](https://forum.inductiveautomation.com/u/Icom)\
**Post date:** [September 3, 2020, 8:31pm UTC](https://forum.inductiveautomation.com/t/how-to-find-a-character-in-a-cell/38370/1 "2020-09-03T20:31:06Z")

</div>

Can someone give me a clue how to find a character in a cell from a powertable.  
Thanks

---

<div class="post-metadata">

**Author:** ![Icom](https://avatars.discourse-cdn.com/v4/letter/i/e68b1a/32.png) [@Icom](https://forum.inductiveautomation.com/u/Icom)\
**Post date:** [September 3, 2020, 9:36pm UTC](https://forum.inductiveautomation.com/t/how-to-find-a-character-in-a-cell/38370/2 "2020-09-03T21:36:50Z")

</div>

I have tried this but it doesn’t work.

```auto
**string=self.data.getValueAt(rowIndex,'ALIMNAME1')**

	if 'G' in string:
		if colName == 'T2T' or colName == 'T2TH' or colName == 'T2_DIA' :
			if float(self.data.getValueAt(rowIndex,'T2_DIA')) < float(self.data.getValueAt(rowIndex,'T2TH')):
				return {'background': '168,0,0'}

```

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 4, 2020, 11:01am UTC](https://forum.inductiveautomation.com/t/how-to-find-a-character-in-a-cell/38370/3 "2020-09-04T11:01:30Z")

</div>

Use hex values for your color. Also, I recommend defining a default set of colors at the beginning. It will make it more flexible if you add functionality:

```auto
	config = {'background': 'white', 'foreground':'black'}

	string = self.data.getValueAt(rowIndex,'ALIMNAME1')
	
	if 'G' in string:
		if colName == 'T2T' or colName == 'T2TH' or colName == 'T2_DIA' :
			if float(self.data.getValueAt(rowIndex,'T2_DIA')) < float(self.data.getValueAt(rowIndex,'T2TH')):
				config['background'] = '#A80000'}
				config['foreground'] = 'white'
		
	return config
```

---

<div class="post-metadata">

**Author:** ![Icom](https://avatars.discourse-cdn.com/v4/letter/i/e68b1a/32.png) [@Icom](https://forum.inductiveautomation.com/u/Icom)\
**Post date:** [September 4, 2020, 12:02pm UTC](https://forum.inductiveautomation.com/t/how-to-find-a-character-in-a-cell/38370/4 "2020-09-04T12:02:25Z")

</div>

Thanks for you answer.
