# Filteration of data on form through lookup

**URL:** <https://www.dynamicsuser.net/t/filteration-of-data-on-form-through-lookup/51791>\
**Category:** Developer Forum\
**Created:** [March 29, 2014, 6:25am UTC](https://www.dynamicsuser.net/t/filteration-of-data-on-form-through-lookup/51791 "2014-03-29T06:25:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ax\_developer1](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@ax\_developer1](https://www.dynamicsuser.net/u/ax_developer1)\
**Post date:** [March 29, 2014, 6:25am UTC](https://www.dynamicsuser.net/t/filteration-of-data-on-form-through-lookup/51791/1 "2014-03-29T06:25:45Z")

</div>

Hi Pioneers,

I have my requirement as below:

In “SalesTable”, I have to put a lookup for “SalesStatus”, as when I select “Open” in lookup, the records in “SalesTable” form, should get filtered with those “SalesOrders”, whose “SalesStatus” is “Open”, if when I select “Invoiced” in lookup, the records in “SalesTable” form, should get filtered with those “SalesOrders”, whose “SalesStatus” is “Invoiced”. I am new to Ax , please guide me.

---

<div class="post-metadata">

**Author:** ![MartinDrab](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@MartinDrab](https://www.dynamicsuser.net/u/MartinDrab)\
**Post date:** [March 29, 2014, 9:35am UTC](https://www.dynamicsuser.net/t/filteration-of-data-on-form-through-lookup/51791/2 "2014-03-29T09:35:26Z")

</div>

You can override the lookup() method of the data source field (or the form control, if it’s not bound to any data source field) and add a range there. See [How to: Add a Lookup Form to a Control](http://msdn.microsoft.com/en-us/library/hh185372.aspx).

---

<div class="post-metadata">

**Author:** ![ax\_developer1](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@ax\_developer1](https://www.dynamicsuser.net/u/ax_developer1)\
**Post date:** [March 29, 2014, 11:08am UTC](https://www.dynamicsuser.net/t/filteration-of-data-on-form-through-lookup/51791/3 "2014-03-29T11:08:51Z")

</div>

Hi Martin,

Thanks a ton !!!

How many lookups should I write ? For example, should I write a lookup for filteration on the basis of “Open Orders”, “Invoiced Orders” etc. ??? Or may I write “selectionChange()” method ???

---

<div class="post-metadata">

**Author:** ![MartinDrab](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@MartinDrab](https://www.dynamicsuser.net/u/MartinDrab)\
**Post date:** [March 30, 2014, 12:14pm UTC](https://www.dynamicsuser.net/t/filteration-of-data-on-form-through-lookup/51791/4 "2014-03-30T12:14:36Z")

</div>

There is just one lookup method for the field. What you need to do is setting the range value from your parameter. For example:

_statusQueryBuildRange.value(queryValue(statusParameter.selection()));_
