Selecting based on value instead of a row?

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?

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

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