# Refreshing multiple tables in Vision

**URL:** <https://forum.inductiveautomation.com/t/refreshing-multiple-tables-in-vision/55771>\
**Category:** Ignition\
**Created:** [February 4, 2022, 6:08pm UTC](https://forum.inductiveautomation.com/t/refreshing-multiple-tables-in-vision/55771 "2022-02-04T18:08:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinezraulrogelio](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@martinezraulrogelio](https://forum.inductiveautomation.com/u/martinezraulrogelio)\
**Post date:** [February 4, 2022, 6:08pm UTC](https://forum.inductiveautomation.com/t/refreshing-multiple-tables-in-vision/55771/1 "2022-02-04T18:08:28Z")

</div>

Hi everyone,  
I write a little piece of code to make easier refreshing multiple tables, but still do not get it work,  
is there a way to refresh multiple components?

this is the code i write but i get the error :

TypeError: refresh(): 1st arg can’t be coerced to javax.swing.JComponent

CODE  
List = [“Power Table”,“Power Table 1”]  
ListName = [“Component”]\*len(List)  
for i in range(len(List)):  
ListName[i] = “event.source.parent.getComponent(’”+str(List[i])+"’)"  
system.db.refresh(str(ListName[i]), “data”)

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [February 4, 2022, 6:21pm UTC](https://forum.inductiveautomation.com/t/refreshing-multiple-tables-in-vision/55771/2 "2022-02-04T18:21:31Z")

</div>

i don’t think you can use a list for this. If you only have two tables, you could just run two separate refreshes. If you have many, you could create a loop.

```auto
table = event.source.parent.getComponent("Power Table")
table1 = event.source.parent.getComponent("Power Table 1")
system.db.refresh(table, "data")
system.db.refresh(table1, "data")

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 4, 2022, 7:35pm UTC](https://forum.inductiveautomation.com/t/refreshing-multiple-tables-in-vision/55771/3 "2022-02-04T19:35:16Z")

</div>

Sure, you can use a list - just gotta treat the things a bit differently.

```auto
components = [
	"Power Table",
	"Power Table 1"
]

for name in components:
	component = event.source.parent.getComponent(name)
	system.db.refresh(component, "data")

```

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [February 4, 2022, 7:36pm UTC](https://forum.inductiveautomation.com/t/refreshing-multiple-tables-in-vision/55771/4 "2022-02-04T19:36:54Z")

</div>

You are right, that is what i was trying to articulate with the loop option.
