# Perspective: How do I grab the text property of a dropdown menu?

**URL:** <https://forum.inductiveautomation.com/t/perspective-how-do-i-grab-the-text-property-of-a-dropdown-menu/24371>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [April 24, 2019, 8:02pm UTC](https://forum.inductiveautomation.com/t/perspective-how-do-i-grab-the-text-property-of-a-dropdown-menu/24371 "2019-04-24T20:02:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattUlmer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mattulmer/32/8736_2.png) [@MattUlmer](https://forum.inductiveautomation.com/u/MattUlmer)\
**Post date:** [April 24, 2019, 8:02pm UTC](https://forum.inductiveautomation.com/t/perspective-how-do-i-grab-the-text-property-of-a-dropdown-menu/24371/1 "2019-04-24T20:02:26Z")

</div>

In Perspective, I need to grab the ‘selectedStringValue’ (that is what it is named in Vision clients) from a dropdown component that is populated from a dataset. There is no property for this in Perspective dropdown components though.

I also attempted to grab it from the underlying dataset using the script below (in both the onChange event, and change-script (directly on the property) against the dropdown), but they won’t work either (the code does work against a known dataset - I am attempting to get it from props.options). That means I don’t know where the dataset is stored, although the interface seems to suggest the options property.

The console does not report anything to me from these event, not errors or print()'s, so debugging is an issue also.

Thanks for any help you might have.

```auto
	data = self.props.options
	for row in range(data.getRowCount()):
		if (data.getValueAt(row, "value") == currentValue):
			self.getSibling('Label').props.text = data.getValueAt(row, "label")
			self.custom.displayvalue = data.getValueAt(row, "label")

```

-Matt

---

<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:** [April 24, 2019, 8:06pm UTC](https://forum.inductiveautomation.com/t/perspective-how-do-i-grab-the-text-property-of-a-dropdown-menu/24371/2 "2019-04-24T20:06:31Z")

</div>

> [@MattUlmer](#):
>
> The console does not report anything to me from these event, not errors or print()'s, so debugging is an issue also.

Perspective events run in the gateway, even for the designer. Look in the gateway log. If printing instead of logging, look in the wrapper log.

---

<div class="post-metadata">

**Author:** ![silverbacknet](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/silverbacknet/32/7385_2.png) [@silverbacknet](https://forum.inductiveautomation.com/u/silverbacknet)\
**Post date:** [April 24, 2019, 10:11pm UTC](https://forum.inductiveautomation.com/t/perspective-how-do-i-grab-the-text-property-of-a-dropdown-menu/24371/3 "2019-04-24T22:11:58Z")

</div>

That’s because the event is onSelect, not onChange. I forget what onChange is even for, hopefully the Perspective docs will be expanded to clear up what events apply to what components soon. Right now only a handful are documented.

---

<div class="post-metadata">

**Author:** ![MattUlmer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mattulmer/32/8736_2.png) [@MattUlmer](https://forum.inductiveautomation.com/u/MattUlmer)\
**Post date:** [April 25, 2019, 1:30pm UTC](https://forum.inductiveautomation.com/t/perspective-how-do-i-grab-the-text-property-of-a-dropdown-menu/24371/4 "2019-04-25T13:30:28Z")

</div>

I appreciate the info on that part of the question. I am now using the gateway’s logs for my current debugging needs.

---

<div class="post-metadata">

**Author:** ![MattUlmer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mattulmer/32/8736_2.png) [@MattUlmer](https://forum.inductiveautomation.com/u/MattUlmer)\
**Post date:** [April 25, 2019, 4:43pm UTC](https://forum.inductiveautomation.com/t/perspective-how-do-i-grab-the-text-property-of-a-dropdown-menu/24371/5 "2019-04-25T16:43:16Z")

</div>

Thank you for your help. I ended up using the change script as applied to the props.value directly (for now). After working through a few other issues with global scripts, I got what I needed to work. Here it is if anyone cares 🙂

```auto
 def valueChanged(self, previousValue, currentValue, origin):
    DataOutputUtils.setFilterComponentsSelection(self)

# from DataOutputUtils
# any view created with a dropdown that uses a datatype 
# and custom displayvalue property can be used
def setFilterComponentsSelection(component):
	data = component.props.options
	for row in range(data.getRowCount()):
		if (data.getValueAt(row, "value") == component.props.value):
			component.custom.displayvalue = data.getValueAt(row, "label")
			break

```
