Count Records in javascript
Hello,
I'm using a widget on my page, and I need to write the number of fetched records. But the thing is, you can only fetch max 200 records, so I tried to use a loop.
The code below is an infinite loop, because the API call never happens. Is this related to the the promise inside it, or am I just not seeing something obvious? (The appName and reportName is changed here.)
$(document).ready(function(){
var count = 0;
var done = false;
while (done == false)
{
ZOHO.CREATOR.init(done, count)
.then(function(data) {
var configI =
{
appName : 'appname',
reportName : 'reportname',
criteria: 'ID != 0',
page : 1,
pageSize : 200
}
ZOHO.CREATOR.API.getAllRecords(configI).then(function(response){
var recordArrInfo = response.data;
count += recordArrInfo.length;
if (recordArrInfo.length < 200)
{
done = true;
}
else
{
configI.page += 1;
}
});
});
}
}
How can I count the records of my report using javascript?
Thanks,
Ati
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Zoho Orchestly Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.