Getting the selected label of a dropdown

To expand on Sam’s answer, especially if you don’t use integers as your option values:

Create a custom property on the dropdown component with the key ‘selectedLabel’.
Create a Property binding for selectedLabel, linked to this.props.value.
Add a Script transform with the following code:

x = None
for i in range(len(self.props.options)):
	if self.props.options[i].value == value:
		x = self.props.options[i].label
		break
return x

As Sam mentioned, you can then reference self.getSibling('drReasonCode').custom.selectedLabel in your event script.

9 Likes