# Selecting based on value instead of a row?

**URL:** <https://forum.inductiveautomation.com/t/selecting-based-on-value-instead-of-a-row/24332>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [April 23, 2019, 5:52pm UTC](https://forum.inductiveautomation.com/t/selecting-based-on-value-instead-of-a-row/24332 "2019-04-23T17:52:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [April 23, 2019, 5:52pm UTC](https://forum.inductiveautomation.com/t/selecting-based-on-value-instead-of-a-row/24332/1 "2019-04-23T17:52:59Z")

</div>

I have a dropdown menu with the following data

```
value label
2 label2
3 label3
5 label5
4 label4
7 label7
6 label6
11 label11
9 label9
1 label1
8 label8
10 label10

```

And on a button press I compare the value the dropdown currently is compared to what is stored in the database. If they are different, I want a pop up message saying something like “Changed from label3 to label11”. However when I was testing it I realized it was not working at all as intended because I was using the values which are not row indexes. What is the easiest way to get data from a dataset in Ignition not based on a row but based on the a value matching in a column? Is a for loop the only way?

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [April 23, 2019, 6:11pm UTC](https://forum.inductiveautomation.com/t/selecting-based-on-value-instead-of-a-row/24332/2 "2019-04-23T18:11:59Z")

</div>

> [@bkarabinchak.psi](#):
>
> Is a for loop the only way?

I believe the answer to this is yes--something like the following (returns first match):

```python
for row in rows:
	if dataset.getValueAt(row, 'lookupColumnName') == lookupValue:
		return dataset.getValueAt(row, 'returnColumnName')

```
