# Set Tag Value from a specific column from row selection

**URL:** <https://forum.inductiveautomation.com/t/set-tag-value-from-a-specific-column-from-row-selection/10299>\
**Category:** General Discussion\
**Created:** [July 31, 2015, 4:22pm UTC](https://forum.inductiveautomation.com/t/set-tag-value-from-a-specific-column-from-row-selection/10299 "2015-07-31T16:22:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerry101](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@jerry101](https://forum.inductiveautomation.com/u/jerry101)\
**Post date:** [July 31, 2015, 4:22pm UTC](https://forum.inductiveautomation.com/t/set-tag-value-from-a-specific-column-from-row-selection/10299/1 "2015-07-31T16:22:28Z")

</div>

What is the best way to set a “client tag” value based on a specific column of a selected row from table? I tried doing this in an expression but get an error stating “Cannot use a property reference from a tag binding”.

Expression:  
if({Root Container.Table.selectedRow} = -1,  
“0”, // this is the fail case  
{Root Container.Table.data}[{Root Container.Table.selectedRow},  
“ColumnName”])

---

<div class="post-metadata">

**Author:** ![ray.crowder](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@ray.crowder](https://forum.inductiveautomation.com/u/ray.crowder)\
**Post date:** [July 31, 2015, 4:42pm UTC](https://forum.inductiveautomation.com/t/set-tag-value-from-a-specific-column-from-row-selection/10299/2 "2015-07-31T16:42:22Z")

</div>

Consider using the ‘lookup’ expression.

lookup({Root Container.Table.data},{Root Container.Table.selectedRow},0, “ColumnName”)

The “0” is the noMatchValue.

You may need to play around with it to get your desired results. The lookup function takes up to 5 arguments. You could maybe even nest it inside of your if statement.

---

<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:** [August 3, 2015, 6:12am UTC](https://forum.inductiveautomation.com/t/set-tag-value-from-a-specific-column-from-row-selection/10299/3 "2015-08-03T06:12:52Z")

</div>

Write a propertyChange event script on the table that writes to the client tag when the selectedRow changes.

Here is an example of such a script:

```auto
if event.propertyName == "selectedRow" and event.newValue > -1:	
	value = event.source.data.getValueAt(event.newValue,"myColumn")
	system.tag.write("[Client]MyTag",value)
```

Best,
