# Populate a table with OPC tags

**URL:** <https://forum.inductiveautomation.com/t/populate-a-table-with-opc-tags/89599>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [April 28, 2024, 8:01pm UTC](https://forum.inductiveautomation.com/t/populate-a-table-with-opc-tags/89599 "2024-04-28T20:01:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![denny\_jimenez](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@denny\_jimenez](https://forum.inductiveautomation.com/u/denny_jimenez)\
**Post date:** [April 28, 2024, 8:01pm UTC](https://forum.inductiveautomation.com/t/populate-a-table-with-opc-tags/89599/1 "2024-04-28T20:01:43Z")

</div>

I have a project in Vision 8.1, in this project i have a table Vision which has in the rows 20 devices with similar characteristics and in the columns, 2 columns that will reflect electrical variables of each of the devices, for example from device 1 to device 20 I want to see the active and reactive power in the table. of each team. The tag path of each electrical variable is similar for all devices, only a number that identifies the device varies, for example:

For the first electrical variable:  
Equipment 1: [default]INVERTER/Inverter 1/MEASURE/INV\_P\_TOT\_W  
Equipment 2: [default]INVERTER/Inverter 2/MEASURE/INV\_P\_TOT\_W  
.  
.  
.  
Team 20: [default]INVERTER/Inverter 20/MEASURE/INV\_P\_TOT\_W

For the second electrical variable:  
Equipment 1: [default]INVERTER/Inverter 1/MEASURE/INV\_Q\_TOT\_W  
Equipment 2: [default]INVERTER/Inverter 2/MEASURE/INV\_Q\_TOT\_W  
.  
.  
.  
Equipment 20: [default]INVERTER/Inverter 20/MEASURE/INV\_Q\_TOT\_W

How can I populate the table dynamically, taking advantage of the fact that the OPC TAG path is very similar for all devices. I hope for suggestions, if it may be possible to use the features of the Vision Table, or use Template Repeater.

Thanks in advance

---

<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:** [April 30, 2024, 3:24pm UTC](https://forum.inductiveautomation.com/t/populate-a-table-with-opc-tags/89599/3 "2024-04-30T15:24:59Z")

</div>

If you're looking to use a table, then something like this should work. Point the table to the tag, update the tag using a gateway timer script.

```python
def chunker(seq,size):
	return(seq[pos:pos + size] for pos in xrange(0,len(seq),size))

baseTags = ['[default]INVERTER/Inverter {}/MEASURE/INV_P_TOT_W', '[default]INVERTER/Inverter {}/MEASURE/INV_Q_TOT_W']
tagList = []

for i in xrange[20]:
	tagList.extend([tag.format(i+1) for tag in baseTags])

values = [qval.value for qval in system.tag.readBlocking(tagList)]

headers = ['Inverter', 'P_Power', 'Q_Power']
data = [[i+1]+row for i,row in enumerate(chunker(values,2))]

system.tag.writeBlocking(['[default]path/to/tag'], [system.dataset.toDataSet(headers, data)])

```

If using a template (and you should), use the inverter number as a parameter, and bind the display components tags using indirect addressing.

---

<div class="post-metadata">

**Author:** ![denny\_jimenez](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@denny\_jimenez](https://forum.inductiveautomation.com/u/denny_jimenez)\
**Post date:** [May 2, 2024, 2:55pm UTC](https://forum.inductiveautomation.com/t/populate-a-table-with-opc-tags/89599/4 "2024-05-02T14:55:08Z")

</div>

Thank you very much Jordan for the answer, sorry for the late response but I am currently in a field commissioning of equipment

---

<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:** [May 2, 2024, 2:59pm UTC](https://forum.inductiveautomation.com/t/populate-a-table-with-opc-tags/89599/5 "2024-05-02T14:59:32Z")

</div>

No worries. Been there.
