# Object comparation in dropdown

**URL:** <https://forum.inductiveautomation.com/t/object-comparation-in-dropdown/32040>\
**Category:** Ignition\
**Tags:** python\
**Created:** [February 7, 2020, 12:44pm UTC](https://forum.inductiveautomation.com/t/object-comparation-in-dropdown/32040 "2020-02-07T12:44:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor1](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@victor1](https://forum.inductiveautomation.com/u/victor1)\
**Post date:** [February 7, 2020, 12:44pm UTC](https://forum.inductiveautomation.com/t/object-comparation-in-dropdown/32040/1 "2020-02-07T12:44:12Z")

</div>

Hi! What am I missing here?

Here is some code in a dropdown component at onActionPerformed event:

```auto
	itemValido = False

	for item in self.props.options:		
		if item.value == self.props.value:
			itemValido = True
			break

```

I’m using this to check if the user is creating a new item (The option allowCustomOptions is true in the dropdown)

When I use integer values in the dropdown.props.options, its works fine. like this:

```auto
[
  {
    "label": "Excel",
    "value": 1
  },
  {
    "label": "Pacote Office",
    "value": 2
  }
]

```

But when I use object values, it’s doesn’t work:

```auto
[
  {
    "label": "Excel - Básico",
    "value": {
      "value": 1,
      "nivel": 1
    }
  },
  {
    "label": "Excel - Intermeadiário",
    "value": {
      "value": 1,
      "nivel": 2
    }
  }
]

```

The variable itemValido never becomes true

---

<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:** [February 7, 2020, 12:55pm UTC](https://forum.inductiveautomation.com/t/object-comparation-in-dropdown/32040/2 "2020-02-07T12:55:23Z")

</div>

Many objects use the default equality implementation, which effectively means “is this the same object” and doesn’t recurse into the contents of the object. You’ll have to do the inner comparisons yourself in such cases.

---

<div class="post-metadata">

**Author:** ![victor1](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@victor1](https://forum.inductiveautomation.com/u/victor1)\
**Post date:** [February 7, 2020, 2:28pm UTC](https://forum.inductiveautomation.com/t/object-comparation-in-dropdown/32040/3 "2020-02-07T14:28:30Z")

</div>

That is sad news…

Because the idea its to make a flexible component. I don’t know the inner structure of the ‘value’.  
The idea its to use this component in many cases and each case use a diferent ‘value’ object structure…

Is there a generic way to iterate inside the object structure to make the inner comparisons?
