# How to use Multi-Select Dropdown and filter the Power Table

**URL:** <https://forum.inductiveautomation.com/t/how-to-use-multi-select-dropdown-and-filter-the-power-table/84260>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [January 15, 2024, 4:56am UTC](https://forum.inductiveautomation.com/t/how-to-use-multi-select-dropdown-and-filter-the-power-table/84260 "2024-01-15T04:56:27Z")\
**Posts on this page:** 1\
**Showing post:** 6

<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:** [January 16, 2024, 2:27am UTC](https://forum.inductiveautomation.com/t/how-to-use-multi-select-dropdown-and-filter-the-power-table/84260/6 "2024-01-16T02:27:03Z")

</div>

I'm off tomorrow, so if you haven't figured this out by then, I'll set something up in my test environment to demonstrate a few ways to do this.

> [@Matthew\_Lam](#):
>
> {Root Container.Container.MultiSelectDropdown.selectedLabels}

I imagine that you will need to get the column as a list to make it useful for querying, which means you would have to script the query on the `selectedLabels` propertyChange event.

The script would look something like this:

```auto
'''
Written for the script editor of the multiselect dropdown's propertyChange event handler
'''

# If and only if the selectedLabels property of the multiselect dropdown changes
if event.propertyName == 'selectedLabels':
	
	# Get the labels as a list
	labels = event.source.selectedLabels.getColumnAsList(0)
	
	# Create a parameterized query query and match the number of parameters to the number of labels
	query = "SELECT * FROM KoroitSamples WHERE KoroitSamples.[Instrument] IN (%s)" % ', '.join('?' for item in labels)
		
	database = #The database name will need to be defined
	
	# Run the query and assign its result to the data property of the power table
	# Change this path to the relative path of the power table
	event.source.parent.getComponent('Power Table').data = system.db.runPrepQuery(query, labels, database)

```

That script looks proper by my eyes, but full disclosure: I'm not where I can test code at the moment.

---

_[View the full topic](https://forum.inductiveautomation.com/t/how-to-use-multi-select-dropdown-and-filter-the-power-table/84260)._
