# Reset Dropdown filter without resetting power table data

**URL:** <https://forum.inductiveautomation.com/t/reset-dropdown-filter-without-resetting-power-table-data/27885>\
**Category:** Ignition\
**Created:** [August 29, 2019, 5:36pm UTC](https://forum.inductiveautomation.com/t/reset-dropdown-filter-without-resetting-power-table-data/27885 "2019-08-29T17:36:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spatel](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@spatel](https://forum.inductiveautomation.com/u/spatel)\
**Post date:** [August 29, 2019, 5:36pm UTC](https://forum.inductiveautomation.com/t/reset-dropdown-filter-without-resetting-power-table-data/27885/1 "2019-08-29T17:36:32Z")

</div>

Hello Everyone,

I have an power table on my screen. I am selecting the top five-row from SQL server and showing on my ignition screen on power table where I am saying in SQL query binding  
“SELECT Top 5 \* FROM dprint  
where Part\_Number = {Root Container.Power Table.Partnumber}  
and Operation\_Number = {Root Container.Power Table.OperationNumber}.”  
I have two a dropdown for Operation\_Number and Part\_Number where I am saying accordingly in SQL query binding  
“SELECT DISTINCT Operation\_Number FROM dprint.”  
“SELECT DISTINCT Part\_Number FROM dprint”  
Now I made a button to reset both dropdown where I said in scripting  
"event.source.parent.getComponent(‘Dropdown’).selectedValue = -1  
event.source.parent.getComponent(‘Dropdown 1’).selectedValue = -1’

now when I am pressing this reset button dropdown to get reset successfully but it also reset my power table where I am showing my top 5 rows. I don’t want table being reset with dropdown but I want it to show last top 5 rows without any dropdown filter. Can anyone help me with this? That would be highly appreciated.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 29, 2019, 5:48pm UTC](https://forum.inductiveautomation.com/t/reset-dropdown-filter-without-resetting-power-table-data/27885/2 "2019-08-29T17:48:45Z")

</div>

Create two custom properties on your power table, one for part number and one for operation number. Bind your query parameters to your custom properties, not the drop down selections. Then script your drop downs to only write to the custom properties when selectedValue != -1 in the propertyChange event. For example,

```auto
if event.propertyName == 'selectedValue':
   selected = event.source.selectedValue
   if selected != -1:
      event.source.getComponent('powerTable').partNumb = selected
```

---

<div class="post-metadata">

**Author:** ![spatel](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@spatel](https://forum.inductiveautomation.com/u/spatel)\
**Post date:** [August 29, 2019, 6:38pm UTC](https://forum.inductiveautomation.com/t/reset-dropdown-filter-without-resetting-power-table-data/27885/3 "2019-08-29T18:38:07Z")

</div>

I did add two custom properties. I tried to bind custom properties with SQL query saying  
SELECT DISTINCT Operation\_Number from dprint  
and table is getting broken. So now in OperationNumber custom proprties I did expression binding saying  
“’” + {Root Container.Dropdown 1.selectedLabel} + “’”  
and in PartNumber custom properties I did expression binding saying  
“’” + {Root Container.Dropdown.selectedStringValue} + “’”

and in OperationNumber dropdown I did scripting

if event.propertyName == ‘selectedValue’:  
selected = event.source.selectedValue  
if selected != -1:  
event.source.parent.getComponent(‘Power Table’).OperationNumber = selected

likewise in PartNumber. Still, when I press reset dropdown it is resetting my power table.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 29, 2019, 7:14pm UTC](https://forum.inductiveautomation.com/t/reset-dropdown-filter-without-resetting-power-table-data/27885/4 "2019-08-29T19:14:35Z")

</div>

Please format code by encapsulating it with three back quotes in front and behind. The single back quote is above the tab key.

Do not bind the selection of the drop down to the custom properties, that will defeat the purpose. First, get your drop downs to write to the custom properties only when there is a selection. Once you get that working, then use the custom properties in the query.

Make sure that the code I provided you with has proper indentation so it looks like what I posted. Whitespace matters in python/jython. Your Code should look like this

```auto
if event.propertyName == ‘selectedValue’:
	selected = event.source.selectedValue
	if selected != -1:
		event.source.parent.getComponent(‘Power Table’).OperationNumber = selected

```

Once you get this to write to the custom property only when selection is not -1, then do the query like so

```auto
SELECT DISTINCT Operation_Number 
FROM dprint
WHERE Operation_Number = {Root Container.Power Table.Partnumber}

```

I’ve tested all of the above and it does work
