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
ChinnoduChinnodu 

Hi All,I have 10000 records , now i will be retrive 5000 records, how to we can achieve this ?

Hi All,

I have 10000 records , now i will be retrive 5000 records, how to we can achieve this ?

Thanks,
viswa
Adam OlshanskyAdam Olshansky
Is there a specific criteria you want to use to get 5000 of the records or can they be any 5000?  If they can be any, just add LIMIT 5000 to the end of your query.  Otherwise, I'd suggest using a WHERE clause and filtering by Created Date if not another field.
AnjaneyluAnjaneylu
Hi Viswa, 
Normally if you want to display all the 5000 records  in a single vf page is possible if and only if you use the READONLY = TRUE in vf page.
Then you can use this Query to get all the 5000 records.
If you use Readonly = true then we can display upto 10000 records in a single vf page at a time.
Here you can use this Query to display 5000 records..
 
List<Acount> actlist = [SELECT Description,Id,Name,Rating FROM Account LIMIT 5000];
Regard,
Anji
jyothsna reddy 5jyothsna reddy 5
Hi Viswa,

 Actually Visual force can display 1000 records only .If you want display more than 1000 records you can use Pageniation.
You have two options for pagination inside of Visualforce pages
  • Offset
  • StandardSetController
With OFFSET pagination you are limited to 2,000 records; however, with a StandardSetController you can paginate up to 10,000. So, one thing you could do would be to refactor to use the StandardSetController pagination

     Another thing that you could do, would be to add some sort of filtering capability, so that the user can get to the records they need. For example, if you would return more than 2,000 records, display a message saying something like "Showing 2,000 records but there could be more. Please use a filter to narrow down the results."

I hope it will help you.

Regards,
Jyothsna D