How to sort, paginate, and count results in queries
masterYou can control the result set of query functions using keys within the optional first argument object.
Sorting
Use the asc or desc keys. The value should be the column name you wish to sort on.
qbo.findAttachables({
desc: 'MetaData.LastUpdatedTime'
}, function(e, attachables) {
console.log(e, attachables)
})Pagination
Use limit (number of rows to return) and offset (number of rows to skip).
qbo.findAttachables({
limit: 10,
offset: 10
}, function(e, attachables) {
console.log(e, attachables)
})Fetch All Records
By default, the maximum limit is 1000 records. To transparently fetch all available records (issuing multiple requests as needed), set fetchAll: true.
qbo.findCustomers({
fetchAll: true
}, function(e, customers) {
console.log(customers)
})Row Counts
To get the total count of rows instead of the full result set, pass count: true.
qbo.findAttachables({
count: true
}, function(e, attachables) {
console.log(e, attachables)
})