# Is it possible in Vision to get Power Table position and column widths through scripting?

**URL:** <https://forum.inductiveautomation.com/t/is-it-possible-in-vision-to-get-power-table-position-and-column-widths-through-scripting/40723>\
**Category:** Ignition\
**Tags:** vision, ignition80, scripting\
**Created:** [November 17, 2020, 12:05pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-in-vision-to-get-power-table-position-and-column-widths-through-scripting/40723 "2020-11-17T12:05:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![FuernissSandy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/fuernisssandy/32/19532_2.png) [@FuernissSandy](https://forum.inductiveautomation.com/u/FuernissSandy)\
**Post date:** [November 17, 2020, 12:05pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-in-vision-to-get-power-table-position-and-column-widths-through-scripting/40723/1 "2020-11-17T12:05:51Z")

</div>

I got a vision project where some production data is displayed using a power table with three visible columns. By clicking into the table a popup window is loaded visualizing the content of the row that got clicked.  
Now I would like to set position and size of popup window according to screen size (size of MainWindow, gets opened full screen by default), so that the popup window is located right to the first coulmn, using the rest of screen.  
Is it possible to get the position of the power table inside the main window and get the width of the first column by scripting?

---

<div class="post-metadata">

**Author:** ![dustin.cooper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dustin.cooper/32/29963_2.png) [@dustin.cooper](https://forum.inductiveautomation.com/u/dustin.cooper)\
**Post date:** [November 17, 2020, 1:03pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-in-vision-to-get-power-table-position-and-column-widths-through-scripting/40723/2 "2020-11-17T13:03:42Z")

</div>

Yes, you should be able to do that with something like this: (untested)

```auto
myTable = <path to your table component>
tableX = myTable.getX()
tableY = myTable.getY()
firstColumnWidth = myTable.getColumnWidth(0) ## 0 refers to first column index

```

---

<div class="post-metadata">

**Author:** ![FuernissSandy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/fuernisssandy/32/19532_2.png) [@FuernissSandy](https://forum.inductiveautomation.com/u/FuernissSandy)\
**Post date:** [November 18, 2020, 6:49am UTC](https://forum.inductiveautomation.com/t/is-it-possible-in-vision-to-get-power-table-position-and-column-widths-through-scripting/40723/3 "2020-11-18T06:49:35Z")

</div>

> [@dustin.cooper](#):
>
> tableX = myTable.getX() tableY = myTable.getY()

Thank you for your reply.  
.getX() and .getY() worked but .getColumnWidth(0) throws error: object has no attribute 'getColumnWidth'  
how did you know that .getX() exists? I could not find it in documentation neither for Vision scripting ([Scripting in Vision - Ignition User Manual 8.0 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC80/Scripting+in+Vision) ) nor for Power Table documentation ([Vision - Power Table - Ignition User Manual 8.0 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC80/Vision+-+Power+Table)) and also search function ([Search - Ignition Documentation](https://docs.inductiveautomation.com/dosearchsite.action)) does not give a result about this. Is there any other documentation I am missing?

---

<div class="post-metadata">

**Author:** ![FuernissSandy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/fuernisssandy/32/19532_2.png) [@FuernissSandy](https://forum.inductiveautomation.com/u/FuernissSandy)\
**Post date:** [November 18, 2020, 6:57am UTC](https://forum.inductiveautomation.com/t/is-it-possible-in-vision-to-get-power-table-position-and-column-widths-through-scripting/40723/4 "2020-11-18T06:57:48Z")

</div>

found a solution for column width:

> [@How to get Table Column Width?](http://forum.inductiveautomation.com/t/how-to-get-table-column-width/5209):
>
> Dear Inductive Team, We had a requirement where we need to get Table Column width in Event Handler. We mean, Is there any function similar to setColumnWidth() function where we can get Column width on Runtime (In Launched Project) ? We had a look at columnAttributesData for table component. However, values in this dataset are not changing runtime.

---

<div class="post-metadata">

**Author:** ![dustin.cooper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dustin.cooper/32/29963_2.png) [@dustin.cooper](https://forum.inductiveautomation.com/u/dustin.cooper)\
**Post date:** [November 18, 2020, 2:09pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-in-vision-to-get-power-table-position-and-column-widths-through-scripting/40723/5 "2020-11-18T14:09:13Z")

</div>

You are correct - .getColumnWidth() method does not exist on the table component itself. It’s surprising to me that if a .set exists, that a corresponding .get doesn’t also exist at the same level. But, as you found, you can drill down a couple of layers into the column model and get the width of individual columns.  
I have used setColumnWidth previously, so my bad on the assumption that its counterpart existed.

As far as inspecting a component (or any other python object) to see what methods exist, I use the dir(object) method.

```auto
myTable = <path to table component>
for item in dir(myTable):
	if item.startswith('get'):
		print item

```

I use this in a button actionPerformed event handler to inspect components on test screens. You can do this iteratively to find things you are looking for that may not be documented.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 18, 2020, 2:20pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-in-vision-to-get-power-table-position-and-column-widths-through-scripting/40723/6 "2020-11-18T14:20:21Z")

</div>

Another tool is the introspect script that @pturmel wrote: [Finding all available methods from a component](http://forum.inductiveautomation.com/t/finding-all-available-methods-from-a-component/9670/8)

I’ve used that a bunch of times to inspect objects and then using that information to cross reference the SDK documents to look further.

---

<div class="post-metadata">

**Author:** ![FuernissSandy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/fuernisssandy/32/19532_2.png) [@FuernissSandy](https://forum.inductiveautomation.com/u/FuernissSandy)\
**Post date:** [November 19, 2020, 5:54am UTC](https://forum.inductiveautomation.com/t/is-it-possible-in-vision-to-get-power-table-position-and-column-widths-through-scripting/40723/7 "2020-11-19T05:54:33Z")

</div>

Thank you for pointing that out. Good to know that there are methods to find all existing methods for objects, that might be very helpful in my future Ignition projects.
