# Lookup on multiple columns

**URL:** <https://forum.inductiveautomation.com/t/lookup-on-multiple-columns/1600>\
**Category:** Ignition\
**Created:** [March 3, 2010, 6:51pm UTC](https://forum.inductiveautomation.com/t/lookup-on-multiple-columns/1600 "2010-03-03T18:51:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [March 3, 2010, 6:51pm UTC](https://forum.inductiveautomation.com/t/lookup-on-multiple-columns/1600/1 "2010-03-03T18:51:56Z")

</div>

I have a situation where I have to display one of many records depending which one is active. I already have a dataset the has all the records but it also has many other records. It would be nice to:

lookup(dataset,[‘_name_’,1], ‘Unknown’, [‘device’,‘state’],‘device’)

This would look for a record where device = “_name_” (\* is wildcard) and state = 1 and return the name of the device or ‘Unknown’

Not looking for alternate ways. Just saying it would be nice to have.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 3, 2010, 10:11pm UTC](https://forum.inductiveautomation.com/t/lookup-on-multiple-columns/1600/2 "2010-03-03T22:11:57Z")

</div>

Duly noted.

I know you weren’t looking for alternatives, but for everyone else’s benefit, it might be useful to note that you’d typically let the database do this sort of thing with a dynamic WHERE clause. That said, I certainly understand that there is an argument for doing it in a local expression.
