Set Tag Value from a specific column from row selection

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”])

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.

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:

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

Best,