Hey all, I am attempting to use the Javascript API to get records in a Node.js server from a base with 10,000+ records. I have used the offset parameter in the past with CURL but am not getting an offset when my query returns. Here is the query at the moment:
Try increasing maxRecords. The page size determines the number of records per page. Max records determines the total number of records across all pages.
In that case would switching maxRecords to pageSize and using .eachPage instead of .all be the right approach? Somthing like:
const results = await productsBase('Products').select({
filterByFormula: `OR(FIND("${BRAND}",{BRAND}),FIND("${PRODUCT}",{PRODUCT}))`,
pageSize: pageSize,
})
let i = 0
return await results.eachPage(
function page(records, fetchNextPage) {
console.log(':~: products.js:fetchProducts records ', records)
if(i === pageNumber){
return records
} else {
i++
fetchNextPage()
}
},
function done(err) {
if (err) { console.error(err); return; }
}
)
If that is the right approach, how do I return the records from the function? My console log is showing that it is itterating correctly but the records are not being returned.