# Filter power table based in

**URL:** <https://forum.inductiveautomation.com/t/filter-power-table-based-in/67338>\
**Category:** Ignition\
**Created:** [December 7, 2022, 3:41pm UTC](https://forum.inductiveautomation.com/t/filter-power-table-based-in/67338 "2022-12-07T15:41:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cesar\_martinez](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@cesar\_martinez](https://forum.inductiveautomation.com/u/cesar_martinez)\
**Post date:** [December 7, 2022, 3:41pm UTC](https://forum.inductiveautomation.com/t/filter-power-table-based-in/67338/1 "2022-12-07T15:41:13Z")

</div>

Good day,

I have a power table linked with a database that i want to filter based in a specific value. I know that the power table has a filter option from the header, but to simplify the activity in production, i want to scan a code in the text field, press the button and then have the same filter process from the header but with script. Does someone knows how to perform this?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/5/5575fbd270c732bef5e66da3ab656319a1aa074e.png)

I appreciate all the help.

Regards  
CMV

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 7, 2022, 6:09pm UTC](https://forum.inductiveautomation.com/t/filter-power-table-based-in/67338/2 "2022-12-07T18:09:17Z")

</div>

I usually do this sort of thing in my query binding using the text field property as a query parameter. The power table can then be updated with a [refresh](https://docs.inductiveautomation.com/display/DOC81/system.db.refresh)

---

<div class="post-metadata">

**Author:** ![mdia](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdia/32/87599_2.png) [@mdia](https://forum.inductiveautomation.com/u/mdia)\
**Post date:** [December 7, 2022, 6:24pm UTC](https://forum.inductiveautomation.com/t/filter-power-table-based-in/67338/3 "2022-12-07T18:24:51Z")

</div>

Another way to achieve this is by adding this script to the button:

```auto
table = event.source.parent.getComponent("Table")
 
text = event.source.parent.getComponent('Text Field').text 

data = system.db.runPrepUpdate("SELECT <something> FROM <YourTableName> WHERE PartNumber = ?", [text])

event.source.parent.getComponent('Table').data = data

```

---

<div class="post-metadata">

**Author:** ![cesar\_martinez](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@cesar\_martinez](https://forum.inductiveautomation.com/u/cesar_martinez)\
**Post date:** [December 13, 2022, 2:29pm UTC](https://forum.inductiveautomation.com/t/filter-power-table-based-in/67338/4 "2022-12-13T14:29:11Z")

</div>

Thank you guys for your support.

Regards  
CMV
