# Clicking button to import table before collecting data

**URL:** <https://forum.inductiveautomation.com/t/clicking-button-to-import-table-before-collecting-data/43368>\
**Category:** Ignition\
**Created:** [February 12, 2021, 5:57pm UTC](https://forum.inductiveautomation.com/t/clicking-button-to-import-table-before-collecting-data/43368 "2021-02-12T17:57:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [February 12, 2021, 5:57pm UTC](https://forum.inductiveautomation.com/t/clicking-button-to-import-table-before-collecting-data/43368/1 "2021-02-12T17:57:38Z")

</div>

So i have it where when someone fills out a text input - script runs to grab data from table, then writes specific data to tags which are used to display info.

But what I want is the table import button to be done prior to collecting the data. This way I can ensure my table where the data is being grabbed from is up to date.

i am assuming i can do this with a doClick but everytime I add one, it switches me to another window. without the doClick, it does this without actually showing the other windows. code is below.

```auto
value = event.source.parent.getComponent('WF Input').text
system.tag.writeToTag('System1/Efficiency/Line_6/WF_Num', value)

system.nav.openWindow("Main Windows/Table Import")
window = system.gui.getWindow("Main Windows/Table Import")
data = window.rootContainer.getComponent("Item Master").data
system.nav.closeWindow("Main Windows/Table Import")

WF = value
	
for row in range(data.rowCount):
	index_row = data.getValueAt(row, 0)
	if index_row == WF:
		prod_nam = data.getValueAt(row, 1)
		bot_size = data.getValueAt(row, 2)
		allergen = data.getValueAt(row, 3)
		system.tag.writeToTag('System1/Efficiency/Line_6/Product_Name', prod_nam)
		system.tag.writeToTag('System1/Efficiency/Line_6/Bottle Size', bot_size)
		system.tag.writeToTag('System1/Efficiency/Line_6/ALLERGEN', allergen)
			

```

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [February 12, 2021, 6:03pm UTC](https://forum.inductiveautomation.com/t/clicking-button-to-import-table-before-collecting-data/43368/2 "2021-02-12T18:03:03Z")

</div>

I updated this section

```auto
system.nav.openWindow("Main Windows/Table Import")
window = system.gui.getWindow("Main Windows/Table Import")
window.rootContainer.getComponent("Table Import").doClick()
data = window.rootContainer.getComponent("Item Master").data
system.nav.closeWindow("Main Windows/Table Import")

```

then the import shows up on the current window vs doing it in the background importing then collecting newly imported data to write to tags

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [February 12, 2021, 6:13pm UTC](https://forum.inductiveautomation.com/t/clicking-button-to-import-table-before-collecting-data/43368/3 "2021-02-12T18:13:59Z")

</div>

Now it works, but the button pops up on the screen for a split second. Is there a way to hide it from showing while running

```auto
system.nav.openWindow("Main Windows/Table Import")
window = system.gui.getWindow("Main Windows/Table Import")
button = window.rootContainer.getComponent("Table Import")
button.doClick()
data = window.rootContainer.getComponent("Item Master").data
system.nav.closeWindow("Main Windows/Table Import")

```

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [February 12, 2021, 8:23pm UTC](https://forum.inductiveautomation.com/t/clicking-button-to-import-table-before-collecting-data/43368/4 "2021-02-12T20:23:43Z")

</div>

i just turned off visibility for button in the property editor
