# PowerTable Binding via Script or Indirection Template?

**URL:** <https://forum.inductiveautomation.com/t/powertable-binding-via-script-or-indirection-template/32402>\
**Category:** Ignition\
**Tags:** sdk, scripting, ignition80\
**Created:** [February 18, 2020, 11:36pm UTC](https://forum.inductiveautomation.com/t/powertable-binding-via-script-or-indirection-template/32402 "2020-02-18T23:36:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul.bouillon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.bouillon/32/7980_2.png) [@paul.bouillon](https://forum.inductiveautomation.com/u/paul.bouillon)\
**Post date:** [February 18, 2020, 11:36pm UTC](https://forum.inductiveautomation.com/t/powertable-binding-via-script-or-indirection-template/32402/1 "2020-02-18T23:36:36Z")

</div>

Hello,

I’m curious if it is possible to add bindings to vision components properties via script…i’ve done some digging in the component methods – couldn’t find anything that resembled access to the “PropertyAdapters”

We are looking to populate a powertable with many columns of data with each row to be populated by a UDT instance (while I know we can create something similar via template repeater, I think the powertable representation of the data is more suitable to us (provides built-in filtering, sorting, etc.)

It is not so cumbersome to perform the cell update binding for a single row – but we will have _many_ rows, and the number of rows will require changes with more instances of our UDT being instantiated – it is not practical to update the 10+ cell update bindings per row, each time our UDT list changes.

Ideally, we would hope to have the binding indirection completed automatically, based on a single list/dataset of tag paths.

Any ideas would be greatly appreciated!

Kind Regards,

-Paul

---

<div class="post-metadata">

**Author:** ![paul.bouillon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.bouillon/32/7980_2.png) [@paul.bouillon](https://forum.inductiveautomation.com/u/paul.bouillon)\
**Post date:** [February 19, 2020, 11:49pm UTC](https://forum.inductiveautomation.com/t/powertable-binding-via-script-or-indirection-template/32402/2 "2020-02-19T23:49:01Z")

</div>

I think I’m part way there… any help would be greatly appreciated…

I believe the heirarchy is as follows:

- Interaction Controller ([http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/InteractionController.html](http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/InteractionController.html))
- Cell Update Adapter ([http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/CellUpdateAdapter.html](http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/CellUpdateAdapter.html))
- Cell Update Specs ([http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/CellUpdateAdapter.CellUpdateSpec.html](http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/CellUpdateAdapter.CellUpdateSpec.html))
  - Row Identifier ([http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/CellUpdateAdapter.RowIdentifier.html](http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/CellUpdateAdapter.RowIdentifier.html))

- Query Holder ([http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/QueryHolder.html](http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/QueryHolder.html))
- Query Node ([http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/QueryHolder.QueryNode.html](http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/factorypmi/application/binding/QueryHolder.QueryNode.html))
- Tag Listener ([http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/ignition/common/expressions/TagListener.html](http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.6/com/inductiveautomation/ignition/common/expressions/TagListener.html))

I believe that I’m able to create “CellUpdateSpec” object correctly – but I am unable to set the “CellUpdateAdapter” to use the new list of CellUpdateSpec objects…

e.g. in my component event script

```auto
from com.inductiveautomation.ignition.common.expressions import TagListener
from com.inductiveautomation.factorypmi.application.binding.CellUpdateAdapter import CellUpdateSpec, RowIdentifier
from com.inductiveautomation.factorypmi.application.binding import QueryHolder
from com.inductiveautomation.factorypmi.application.binding.QueryHolder import QueryNode

tag_path = '[default]TEST_TAG'

# set up our tag listener
tl = TagListener()
tl.setTagPath(tag_path)

# add our tag listener to the query node
qn = QueryNode()
qn.setTagListener(tl)

# add our query node to the query holder
qh = QueryHolder()
qh.setNodes([qn])

# create a row identifier -- can match value in a column to return row, or simply by idx
ri = RowIdentifier('Tag_Path','test') # we have a column named "Tag_Path" with a row that has a value of "test" -- I would like to update the value of the "Description" column in this row with our "TEST_TAG" value

# create our cell update spec
cus = CellUpdateSpec(ri, 'Description', qh)

# add this new cell update binding to our component!
cmp = event.source
w = system.gui.getParentWindow(event)
ic = w.getInteractionController() # get the window interaction controller

# grab the correct adapter
for a in ic.getAllAdaptersForTarget(cmp):
    if isinstance(a, CellUpdateAdapter):
		cul = a.getUpdates() # get the list of cell update specs
		a.setUpdates(cul.append(cus)) # update the cell update spec list with our new item
		break #TODO: throws error....perhaps I need to "startup" the tag listener?

```

---

<div class="post-metadata">

**Author:** ![garrett.abe](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@garrett.abe](https://forum.inductiveautomation.com/u/garrett.abe)\
**Post date:** [February 24, 2022, 11:30pm UTC](https://forum.inductiveautomation.com/t/powertable-binding-via-script-or-indirection-template/32402/3 "2022-02-24T23:30:35Z")

</div>

Hello,

Were you able to get your script to work?
