Data_query inconsistent number of records, How to use limit default?

Using the Ruby SDK. I just want to get the default maximum results but when I use a limit too big I get no results and sometimes it’s just inconsistent and weird.

I query the data_query endpoint 3 times only changing the limit. 50, 60 and 100

    contacts = @is.data_query("Contact", 50, 1, {:DateCreated => '~>~ 2021-10-01 00:00:00'}, [:ID, :FirstName, :LastName, :Groups, :DateCreated])
    Rails.logger.debug("contacts COUNT: " + contacts.length().to_s)

    contacts = @is.data_query("Contact", 60, 1, {:DateCreated => '~>~ 2021-10-01 00:00:00'}, [:ID, :FirstName, :LastName, :Groups, :DateCreated])
    Rails.logger.debug("contacts COUNT: " + contacts.length().to_s)

    contacts = @is.data_query("Contact", 100, 1, {:DateCreated => '~>~ 2021-10-01 00:00:00'}, [:ID, :FirstName, :LastName, :Groups, :DateCreated])
    Rails.logger.debug("contacts COUNT: " + contacts.length().to_s)

The results are inconsistent and makes no sense.

contacts COUNT: 30
contacts COUNT: 20
contacts COUNT: 0

Thanks for any insight!
Zak

The page numbers are 0 based. So page 1 is the second page.

Based on the data in your example it appears you have 80 contacts matching the query. When you ask for a limit of 50, the second page contains 30 results. When you ask for a limit of 60, the second page contains 20 results, and when you ask for a limit of 100 the second page contains no results because they are all on the first page.

Hope this clarifies things!

1 Like

An off by one error!! oh man… thanks Justin. Greatly appreciate the fast and correct response!