# system.dataset.filterColumns

**URL:** <https://forum.inductiveautomation.com/t/system-dataset-filtercolumns/65707>\
**Category:** Ignition\
**Tags:** ignition81, database, perspective\
**Created:** [October 26, 2022, 2:06pm UTC](https://forum.inductiveautomation.com/t/system-dataset-filtercolumns/65707 "2022-10-26T14:06:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![theo](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@theo](https://forum.inductiveautomation.com/u/theo)\
**Post date:** [October 26, 2022, 2:06pm UTC](https://forum.inductiveautomation.com/t/system-dataset-filtercolumns/65707/1 "2022-10-26T14:06:19Z")

</div>

Hi all,  
I want to filter my dataset by using a dropdown list in a binding script  
the problem is when get the value from my dropdown list and I do the filter on the dataset it gave me an error

the dataset :  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/4/d478bf5e02233a9ec97fa51b45854816d0eb9145.png)

> dataset = self.parent.custom.chart\_L\_sup\_p1  
> nb = 2,self.custom.key  
> value = system.dataset.filterColumns(dataset, nb)  
> return value

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 26, 2022, 2:12pm UTC](https://forum.inductiveautomation.com/t/system-dataset-filtercolumns/65707/2 "2022-10-26T14:12:57Z")

</div>

> [@theo](#):
>
> it gave me an error

What is it ?

And why is the `nb = 2, self.custom.key` line appearing like a link in the snippet ?  
edit: I'm thinking you initially surrounded ` 2, self.custom.key` with parenthesis and used a quote block instead of a code block, which made it interpret it like if it was markdown...  
Use code blocks instead.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 26, 2022, 2:18pm UTC](https://forum.inductiveautomation.com/t/system-dataset-filtercolumns/65707/3 "2022-10-26T14:18:55Z")

</div>

Please use the \</\> code formatting button when posting code. It will indent properly (important for Python) and give syntax highlighting. You can use the 🖉 edit link to fix your post.

---

<div class="post-metadata">

**Author:** ![Sean\_Tesch](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sean_tesch/32/40094_2.png) [@Sean\_Tesch](https://forum.inductiveautomation.com/u/Sean_Tesch)\
**Post date:** [October 26, 2022, 2:28pm UTC](https://forum.inductiveautomation.com/t/system-dataset-filtercolumns/65707/4 "2022-10-26T14:28:09Z")

</div>

Same question as @pascal.fragnoud, but according to the docs, the 'columns' param is a List of either string or int.

The line given is a Tuple:  
`nb = 2, self.custom.key`

For it to be a List, it should be declared with brackets:  
`nb = [2, self.custom.key]`

Assuming the filterColumns method doesn't covert from Tuple to List, this could be your issue.  
Hope this helps.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 26, 2022, 2:34pm UTC](https://forum.inductiveautomation.com/t/system-dataset-filtercolumns/65707/5 "2022-10-26T14:34:58Z")

</div>

It does work with tuples.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/7/97b3bf795378b3e8c6d4b1ee81a8eb8bd2d96a65.png)

---

<div class="post-metadata">

**Author:** ![Sean\_Tesch](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sean_tesch/32/40094_2.png) [@Sean\_Tesch](https://forum.inductiveautomation.com/u/Sean_Tesch)\
**Post date:** [October 26, 2022, 2:37pm UTC](https://forum.inductiveautomation.com/t/system-dataset-filtercolumns/65707/6 "2022-10-26T14:37:18Z")

</div>

I also noticed your edit where OP may have used parenthesis in the declaration, making the nb variable a set, correct? Does the filterOptions method also take in sets?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 26, 2022, 2:38pm UTC](https://forum.inductiveautomation.com/t/system-dataset-filtercolumns/65707/7 "2022-10-26T14:38:44Z")

</div>

Parentheses make tuples, sets are made with curly brackets:

```python
this_is_a_tuple = (1, 2, 3)
this_is_a_set = {1, 2, 3}

```

edit: Unless there's nothing inside the brackets, in which case it makes an empty dict.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 26, 2022, 2:40pm UTC](https://forum.inductiveautomation.com/t/system-dataset-filtercolumns/65707/8 "2022-10-26T14:40:06Z")

</div>

I suspect you will be disappointed. This:

```auto
nb = 2,self.custom.key
value = system.dataset.filterColumns(dataset, nb)

```

suggests to me that you want the **row** where column 2 matches the given key value. That's not what [filterColumns](https://docs.inductiveautomation.com/display/DOC81/system.dataset.filterColumns) does.

If so, see this topic, but reverse its sense:

> [@Delete value on the tag dataset](https://forum.inductiveautomation.com/t/delete-value-on-the-tag-dataset/65653):
>
> if I want to remove the number 20 for example in the dataset of type 4x1 NameColumn 30 20 12 10 I use this line of code: dsDevice = self.view.params.listZoneDesservies # dataset dsDevice = system.dataset.deleteRow(dsDevice,self.view.params.idZone) The problem is that I know the value I want to delete but not its index. In the dataset, each value will be unique. so if I can delete a value without knowing its index, that would be good What function should I use to remove the value witho…
