A question on queries and returned records

How can one set a limit on a query?

And what happens when a query returns 0 records… is the BackendlessCollection<T> null or size 0 ?

Hello! I assume you are using android sdk. Answering your questions: quantity of objects to be returned is set as page size in query. If query returns 0 records - then collection would have 0 size. Also note please that maximum page size is 100, default is 10.
Best regards,

Thanks for your fast response :slight_smile: … so setting the page size to 1 will limit the record set returned to one right ?

And you get the only record using list.getData().get(0)

Yes, thats right. Of course, if there would be that 1 record. I mean that you should check the size of returned collection by checking condition list.getData().size() > 0 before calling list.getData().get(0). More about making requests to Data service you can read here: https://backendless.com/documentation/data/android/data_basic_search.htm, https://backendless.com/documentation/data/android/data_search_and_query.htm.

And do not hesitate to write us if you have questions.
best regards,