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

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.

	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")


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.

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.

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

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 :slight_smile:

 def valueChanged(self, previousValue, currentValue, origin):

# 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")