# Perspective script syntax to check null value on dropdown component value

**URL:** <https://forum.inductiveautomation.com/t/perspective-script-syntax-to-check-null-value-on-dropdown-component-value/30749>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 17, 2019, 1:24am UTC](https://forum.inductiveautomation.com/t/perspective-script-syntax-to-check-null-value-on-dropdown-component-value/30749 "2019-12-17T01:24:29Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![guganathan.r](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@guganathan.r](https://forum.inductiveautomation.com/u/guganathan.r)\
**Post date:** [December 17, 2019, 5:15am UTC](https://forum.inductiveautomation.com/t/perspective-script-syntax-to-check-null-value-on-dropdown-component-value/30749/3 "2019-12-17T05:15:42Z")

</div>

Dear Deon,  
Thanks for prompt response.  
Provided syntax works well when the dropdown.props.value is null (that is whenever I select one value in dropdown and clear the content, dropdown.props.value is null and syntax works).  
But during the session starup or view switchover, the dropdown.props.value is blank, hence the above syntax didnt solve my problem completely.  
However I created a custom value as selected label and used the syntax you provided, it works well and solved my issue.  
For custom selectedlabel I followed this recommendation:

> [@Getting the selected label of a dropdown](http://forum.inductiveautomation.com/t/getting-the-selected-label-of-a-dropdown/21956/3):
>
> 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('drRea…

Syntax I used as:  
self.getSibling("Dropdown").custom.selectedlabel == None:

Thanks.

---

_[View the full topic](https://forum.inductiveautomation.com/t/perspective-script-syntax-to-check-null-value-on-dropdown-component-value/30749)._
