# Power Table add 2 columns value

**URL:** <https://forum.inductiveautomation.com/t/power-table-add-2-columns-value/55595>\
**Category:** Ignition\
**Created:** [February 1, 2022, 12:09pm UTC](https://forum.inductiveautomation.com/t/power-table-add-2-columns-value/55595 "2022-02-01T12:09:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [February 1, 2022, 12:09pm UTC](https://forum.inductiveautomation.com/t/power-table-add-2-columns-value/55595/1 "2022-02-01T12:09:18Z")

</div>

```auto
tableComponent = event.source.parent.getComponent('Power Table')
table = tableComponent.getTable()

selectedRows = table.getSelectedRows()
print selectedRows
selectedColumns = table.getSelectedColumns()
print selectedColumns

for r in selectedRows:
	for c in selectedColumns:
		if table.isCellSelected(r,c):
			print "Row: ", r, "Col: ", c," ColName: ", table.getColumnName(c), " Value: ", table.getValueAt(r,c)

```

I am using this script to get selected rows from power tabel

my output

```auto
Row: 0 Col: 0 ColName: Work order Value: 2634
Row: 0 Col: 1 ColName: Recipe Value: 5/8 TYPE X 4X8 BA-K32
Row: 1 Col: 0 ColName: Work order Value: 2637
Row: 1 Col: 1 ColName: Recipe Value: 5/8 GLASROC TILEBCKR (CANADA) 4X8-K32
Row: 2 Col: 0 ColName: Work order Value: 2638
Row: 2 Col: 1 ColName: Recipe Value: 1/2 GLASROC TILEBCKR (CANADA) 4X8-K40
Row: 3 Col: 0 ColName: Work order Value: 2640
Row: 3 Col: 1 ColName: Recipe Value: 5/8 TYPE X 4X10 BA-K32

```

Actually i want to combine  
Row: 0 Col: 0 and Row: 0 Col: 1 value like this

**2634$5/8 TYPE X 4X8 BA-K32**

same way for others also  
Row: 1 Col: 0 and Row: 1 Col: 1 … goes on

how to achieve this can any one give me idea?

actually i have power table and i am selecting few rows  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/f/9fc8f8a91d0c05718fe51b3e46da12591305ce99.png)

**i want to combine first column data with $ symbol with second column data** (note only with same row)

i dont know how to do that for inly selected rows only?

---

<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:** [February 1, 2022, 1:46pm UTC](https://forum.inductiveautomation.com/t/power-table-add-2-columns-value/55595/2 "2022-02-01T13:46:36Z")

</div>

You can join the string values of the columns into a list. Then, [join the list](https://www.w3schools.com/python/ref_string_join.asp).

```python
table = event.source.parent.getComponent('Power Table').getTable()

selectedRows = table.selectedRows

# Use for entire row:
# selectedColumns = xrange(table.getColumnCount())

# Use for selectedColumns
selectedColumns = table.selectedColumns

for row in selectedRows:
	dataList = []
	for col in selectedColumns:
		# Append the string value to the list
		dataList.append(str(table.getValueAt(row, col)))
	# Print the list
	print dataList
	# Print the joined list
	print '$'.join(dataList)

```
