function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
YCRYCR 

How to get records count

Hi All


I have a custom object that contains more than 100,000 records. Now I want to get count of records on visualforce page. But apex has a governor limits of 10,000 query rows. And API calls is also not fulfill this requirement, due to API calls limit per day.


Any other idea???


Thanks



Richie DRichie D

Hi

 

You maybe able to use this type of query:-

 

 

SELECT count() FROM Contact

 

 This will return a 'count' of your records. I've never tried it with data to pust the govenor limits but I'd have thought it'd work.

R. 

 

MakMak

No Richie, even this won't work as even count works accoridng to governor limits.

 

I suggest you use an actionPoller on a page and get count o 10,000 records at a time and on each action call; keep adding to some property of VF controller. 

Richie DRichie D

Interesting on the count() with govenor limits....

 

If actionpoller isn't an option you could have a custom object with a number value which is updated by triggers to +/- 1 depending on whether an item is deleted or added. This would be more efficient but involves creating another custom object. Maybe you have another object you could append this field to?

 

 

YCRYCR

Hi Mak

 

Do you have any sample code with the use of actionPoller that fulfill your statement ?

I think we can't get correct record count using actionPoller. what condition you put to stop poller???

 

Any way I got the solution.