# Rest Query Requires Top Function

**URL:** <https://www.epiusers.help/t/rest-query-requires-top-function/61972>\
**Category:** Epicor ERP 10\
**Tags:** rest\
**Created:** [November 19, 2019, 3:52am UTC](https://www.epiusers.help/t/rest-query-requires-top-function/61972 "2019-11-19T03:52:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MjtBiz](https://www.epiusers.help/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@MjtBiz](https://www.epiusers.help/u/MjtBiz)\
**Post date:** [November 19, 2019, 3:52am UTC](https://www.epiusers.help/t/rest-query-requires-top-function/61972/1 "2019-11-19T03:52:50Z")

</div>

I am seeing unexpected behavior when querying Job Operations data using Epicor’s Rest API.

I have a Job (HB\_1000\_T2) with Operations.

 ![image](https://epiusers.help/uploads/default/original/3X/8/a/8a971933ea0eeca49994c64c6cc79579aeacd974.jpeg)

Using the Erp.BO.JobEntrySvc/JobOper service…

 ![image](https://epiusers.help/uploads/default/original/3X/5/d/5dd200c75cf8822635cb9035ae00a5a42b7da5c4.png)

I run a simple query using the Job Number in the filter…

 ![image](https://epiusers.help/uploads/default/original/3X/d/c/dc2961ddf36ce6c69291dedb8d491b3bf76c5a9b.jpeg)

Notice that even though there are Job Operations in the system, the Rest query returns no data.

But when I put a high enough value in the top function of the query, values get returned…

 ![image](https://epiusers.help/uploads/default/original/3X/7/4/74dcaa6a78a251c918008377007af7f1786db7fe.jpeg)

It doesn’t seem right that the query only returns the results only when the top function is used. This is an Epicor hosted environment, so I assume the the server and the Rest API are setup correctly.

What am I missing?

Thanks for your help.

Michael

---

<div class="post-metadata">

**Author:** ![RonL](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/97f17d/32.png) [@RonL](https://www.epiusers.help/u/RonL)\
**Post date:** [November 30, 2020, 2:23pm UTC](https://www.epiusers.help/t/rest-query-requires-top-function/61972/2 "2020-11-30T14:23:19Z")

</div>

I know this was from a year ago but wondering if anybody answered this question. I experiencing the same issue. Thought I was doing something wrong.

---

<div class="post-metadata">

**Author:** ![Olga](https://www.epiusers.help/letter_avatar_proxy/v4/letter/o/57b2e6/32.png) [@Olga](https://www.epiusers.help/u/Olga)\
**Post date:** [November 30, 2020, 2:54pm UTC](https://www.epiusers.help/t/rest-query-requires-top-function/61972/3 "2020-11-30T14:54:40Z")

</div>

This is a problems with row limit and GetRows procedure.

By default only first 100 rows are returned from each table, starting from the top. So whne you ask for rows from the child table, top 100 rows are taken from top table, then child rows for that parent rows are found and filter is applied to them. If child table row you want to find does not belong to any of 100 parent rows, nothing is returned.

If you are not in Saas, then you can remove row limit in web.config. In Saas you can only use $top to override the limit.

---

<div class="post-metadata">

**Author:** ![RonL](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/97f17d/32.png) [@RonL](https://www.epiusers.help/u/RonL)\
**Post date:** [November 30, 2020, 7:22pm UTC](https://www.epiusers.help/t/rest-query-requires-top-function/61972/4 "2020-11-30T19:22:24Z")

</div>

Thanks for the explanation. If I have a large table my queries are going to take a long time. The tables are going to get large and I’ll never know what to set $top to. Thanks again.

---

<div class="post-metadata">

**Author:** ![Olga](https://www.epiusers.help/letter_avatar_proxy/v4/letter/o/57b2e6/32.png) [@Olga](https://www.epiusers.help/u/Olga)\
**Post date:** [November 30, 2020, 7:33pm UTC](https://www.epiusers.help/t/rest-query-requires-top-function/61972/5 "2020-11-30T19:33:15Z")

</div>

You can create BAQ and use it in OData call instead

---

<div class="post-metadata">

**Author:** ![RonL](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/97f17d/32.png) [@RonL](https://www.epiusers.help/u/RonL)\
**Post date:** [November 30, 2020, 7:51pm UTC](https://www.epiusers.help/t/rest-query-requires-top-function/61972/6 "2020-11-30T19:51:38Z")

</div>

Thanks again. Looking into creating a BAQ.

---

<div class="post-metadata">

**Author:** ![RonL](https://www.epiusers.help/letter_avatar_proxy/v4/letter/r/97f17d/32.png) [@RonL](https://www.epiusers.help/u/RonL)\
**Post date:** [November 30, 2020, 8:31pm UTC](https://www.epiusers.help/t/rest-query-requires-top-function/61972/7 "2020-11-30T20:31:23Z")

</div>

THANKS! I created a BAQ and it works great.
