Perspective drop down_ on Select Event

Hi,
In perspective mode, I have a dropdown and text box in my screen, on selection of item and entering some data into screen and I am trying to insert the entered data into data base. I have done this in Vision.

but in Perspective I am not getting scripting. please guide.

image

below is the vision script:

Perspective is completely different than Vision. If you want a selectedStringValue for your dropdown, you will have to create one. Fortunately, it's not that difficult to do.
• First, add a custom property to your dropdown called selectedStringValue:
image
• Then, click the binding icon next to the custom property
image
• Bind the selectedStringValue custom property to the value property of the dropdown:
image
• Before closing the Edit Binding Dialog Box, click the Add Transform button and select Script:
image
• Add the following script, and click Apply before closing the Edit Binding Dialog Box:

#def transform(self, value, quality, timestamp):
	selectedStringValue = ''
	for index in range(len(self.props.options)):
		if self.props.options[index].value == value:
			selectedStringValue = str(self.props.options[index].label)
			break
	return selectedStringValue

The script will loop through the options and return the corresponding selected string value property that can be used in other scripting.

Just remember to give each of your options a unique value:
image

Thank you so much. I will try. let you know

1 Like