# Perspective multi select drop down select all

**URL:** <https://forum.inductiveautomation.com/t/perspective-multi-select-drop-down-select-all/51960>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [October 14, 2021, 9:38pm UTC](https://forum.inductiveautomation.com/t/perspective-multi-select-drop-down-select-all/51960 "2021-10-14T21:38:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [October 14, 2021, 9:38pm UTC](https://forum.inductiveautomation.com/t/perspective-multi-select-drop-down-select-all/51960/1 "2021-10-14T21:38:49Z")

</div>

I have a perspective view for reporting, that uses several multi select drop downs to pass parameters to a report. I would like to be able to create a button that selects all items in a particular drop down. Thus far i haven’t been able get it to work, any suggestions would be much appreciated.

---

<div class="post-metadata">

**Author:** ![chandler](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@chandler](https://forum.inductiveautomation.com/u/chandler)\
**Post date:** [October 14, 2021, 9:50pm UTC](https://forum.inductiveautomation.com/t/perspective-multi-select-drop-down-select-all/51960/2 "2021-10-14T21:50:21Z")

</div>

You want to make a list of all of the values that the dropdown has as options, then set the props.value property of the dropdown to that list. something like this worked for me:

```auto
options = self.getSibling("Dropdown").props.options
values = [option['value'] for option in options]
	
self.getSibling("Dropdown").props.value = values

```

this is assuming that you are using an array of objects for your dropdown options. If you are using a dataset, or something else let me know and I can edit the code to work for that.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [October 14, 2021, 9:55pm UTC](https://forum.inductiveautomation.com/t/perspective-multi-select-drop-down-select-all/51960/3 "2021-10-14T21:55:02Z")

</div>

> [@chandler](#):
>
> ```auto
> options = self.getSibling("Dropdown").props.options
> values = [option['value'] for option in options]
> 	
> self.getSibling("Dropdown").props.value = values
> 
> ```

Thank you! I am using a dataset generated by a query for the options.

---

<div class="post-metadata">

**Author:** ![chandler](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@chandler](https://forum.inductiveautomation.com/u/chandler)\
**Post date:** [October 14, 2021, 9:58pm UTC](https://forum.inductiveautomation.com/t/perspective-multi-select-drop-down-select-all/51960/4 "2021-10-14T21:58:20Z")

</div>

Okay, so you need to modify my code slightly to get the value from the dataset rather than from a dictionary:

```auto
options = self.getSibling("Dropdown").props.options
values = [options.getValueAt(i, 'value') for i in range(options.getRowCount())]
	
self.getSibling("Dropdown").props.value = values

```

The above code is assuming that the value column of your dropdown dataset is named ‘value’. if it is named something else, make sure you change the `options.getValueAt` call to use your column name. Also, make sure your dropdown has the multiSelect property set to `true`

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [October 14, 2021, 10:08pm UTC](https://forum.inductiveautomation.com/t/perspective-multi-select-drop-down-select-all/51960/5 "2021-10-14T22:08:47Z")

</div>

> [@chandler](#):
>
> ```auto
> options = self.getSibling("Dropdown").props.options
> values = [options.getValueAt(i, 'value') for i in range(options.getRowCount())]
> 	
> self.getSibling("Dropdown").props.value = values
> 
> ```

That is perfect, thank you. One of my drop downs has over 200 options, which doesn't work. There must be a character limitation somewhere, it will work with up to 160 options selected.

---

<div class="post-metadata">

**Author:** ![chandler](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@chandler](https://forum.inductiveautomation.com/u/chandler)\
**Post date:** [October 14, 2021, 10:14pm UTC](https://forum.inductiveautomation.com/t/perspective-multi-select-drop-down-select-all/51960/6 "2021-10-14T22:14:30Z")

</div>

That’s odd. I made a dropdown with 200 options, and I was able to select them all using a button with that script. When you say it doesn’t work, what do you mean? What happens when you hit the button?

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [October 14, 2021, 10:20pm UTC](https://forum.inductiveautomation.com/t/perspective-multi-select-drop-down-select-all/51960/7 "2021-10-14T22:20:54Z")

</div>

This is what i get on the report viewer component:  
“Enter a valid report in the “source” property in the Property Editor to display the report.”

My options are strings, if i select them all it comes to 5,382 characters. I many need to look into modifying my base query to include a like ‘%’ when passed a parameter.

---

<div class="post-metadata">

**Author:** ![chandler](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@chandler](https://forum.inductiveautomation.com/u/chandler)\
**Post date:** [October 14, 2021, 10:26pm UTC](https://forum.inductiveautomation.com/t/perspective-multi-select-drop-down-select-all/51960/8 "2021-10-14T22:26:01Z")

</div>

Oh I see. I am not familiar with that component. I thought you meant the dropdown wasn’t able to have 200 options selected. Good luck figuring it out 😀
