# Add Range to Query.

**URL:** <https://www.dynamicsuser.net/t/add-range-to-query/45209>\
**Category:** Developer Forum\
**Created:** [April 10, 2013, 8:31am UTC](https://www.dynamicsuser.net/t/add-range-to-query/45209 "2013-04-10T08:31:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![giridhar](https://avatars.discourse-cdn.com/v4/letter/g/35a633/32.png) [@giridhar](https://www.dynamicsuser.net/u/giridhar)\
**Post date:** [April 10, 2013, 8:31am UTC](https://www.dynamicsuser.net/t/add-range-to-query/45209/1 "2013-04-10T08:31:55Z")

</div>

Hi all,

I added datasources in the form and joined them through datasource properties and made link type as innerjoin. when i open the form i am getting the right query. But now i would like to add another range to that query. How can i add a range through code to the query that is being prepared automatically through the properties of the datasource.

---

<div class="post-metadata">

**Author:** ![ThomasP](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@ThomasP](https://www.dynamicsuser.net/u/ThomasP)\
**Post date:** [April 10, 2013, 9:47am UTC](https://www.dynamicsuser.net/t/add-range-to-query/45209/2 "2013-04-10T09:47:21Z")

</div>

Hi,

First add an executeQuery() method on your form datasource then add the following code inside the executeQuery() method before the super();

this.query().datasourceNo(1).addrange(fieldnum(yourTable,YourField)).value(‘yourRangeExpression’);

hope it helps, please verify if it solves your problem

regards,

Thomas

---

<div class="post-metadata">

**Author:** ![giridhar](https://avatars.discourse-cdn.com/v4/letter/g/35a633/32.png) [@giridhar](https://www.dynamicsuser.net/u/giridhar)\
**Post date:** [April 10, 2013, 11:51am UTC](https://www.dynamicsuser.net/t/add-range-to-query/45209/3 "2013-04-10T11:51:49Z")

</div>

Thank you Thomas it worked.
