# configureCell extension function not working

**URL:** <https://forum.inductiveautomation.com/t/configurecell-extension-function-not-working/49407>\
**Category:** Ignition\
**Created:** [July 30, 2021, 4:28pm UTC](https://forum.inductiveautomation.com/t/configurecell-extension-function-not-working/49407 "2021-07-30T16:28:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [July 30, 2021, 4:28pm UTC](https://forum.inductiveautomation.com/t/configurecell-extension-function-not-working/49407/1 "2021-07-30T16:28:24Z")

</div>

I have a power table where I want to change the background color of the row if the string value of the column “username” equals the user that is currently logged in.

This is the code I can’t get to work:

```auto
	currentuser = system.tag.readBlocking("[System]Client/User/Username.Value")
	
	if self.data.getValueAt(rowView, "username") == currentuser:
		return {'background': 'red'}
	else:
		return {'background': 'white'}

```

I have got the following code to do exactly what I want. If I change currentuser to actual string values it works which makes me think it has something to do with currentuser?

```auto
	if self.data.getValueAt(rowView, "username") == "joe":
		return {'background': 'red'}
	elif self.data.getValueAt(rowView, "username") == "mike":
		return {'background': 'yellow'}
	else:
		return {'background': 'white'}

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 30, 2021, 4:50pm UTC](https://forum.inductiveautomation.com/t/configurecell-extension-function-not-working/49407/2 "2021-07-30T16:50:31Z")

</div>

1. Don’t use `readBlocking` in a `configureCell` function, even for client tags. Add a custom property to the power table and bind that property to the client tag. The `configureCell` function is run directly on the event dispatch thread, so any ‘blocking’ work will lead to significant UI performance degradation - which leads to frustrated users. Client tag reads are relatively safe, because they’re entirely local, but it’s still a bad practice to do anything with tags, the database, etc, in a blocking event handler.
2. `readBlocking` returns a list of `QualifiedValue` objects - you need to unpack that list, and extract the value property (both things that happen automatically if you use a custom property tag binding).

A script to do what you want would be something like this:  
`currentuser = system.tag.readBlocking("[System]Client/User/Username")[0].value`  
But, again - use a custom property, and you don’t have to worry about this.

---

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [July 30, 2021, 4:57pm UTC](https://forum.inductiveautomation.com/t/configurecell-extension-function-not-working/49407/3 "2021-07-30T16:57:39Z")

</div>

I see. Just did read about not putting a system.tag.readBlock in this function call.

If the power table is called PowerTable and my custom property is called currentuser would I use  
self.view.custom.PowerTable.currentuser ?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 30, 2021, 4:59pm UTC](https://forum.inductiveautomation.com/t/configurecell-extension-function-not-working/49407/4 "2021-07-30T16:59:37Z")

</div>

This is Vision. Custom properties are addressable directly on the component, `self.currentuser` in this case.

---

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [July 30, 2021, 5:12pm UTC](https://forum.inductiveautomation.com/t/configurecell-extension-function-not-working/49407/5 "2021-07-30T17:12:20Z")

</div>

Much appreciated!

Resulting code:

```auto
	if self.currentuser == self.data.getValueAt(rowIndex, "username"):
		return {'background': 'FF8A8A'}
	else:
		return {'background': 'white'} 

```
