You need to sign in to do that
Don't have an account?
Palak
Only 200 records are returning On doing pagination.
Hi all,
I am returning a list of contact to visualforce page from apex class and have also applied pagination.
I am using database.queryLocator to accomplish pagination. But only 200 records are always returning on visualforce, although there exists around 20000 records. Please can anybody help me on this, its urgent.Any help would be appreciated.
With Regards
Palak Agarwal
Can you clarify what you mean by applied pagination? If you are using a standard list controller, I think that's intentional - you are paginating through the data from the controller, rather than the controller having all the records and just returning a few at a time.
Hi
Thanks for replying. Following is the snippet that is used for pagination
"
con1 = Database.query(OrderQuery); // list of contacts
Integer pag = Integer.valueOF(25);
con27 = new ApexPages.StandardSetController(con1);
system.debug('test my code : '+pag);
con27.setPageSize(pag); "
But this code is returning maximum of 200 records though there are 23000 records on contact. Please help me to retrieve the remianing contacts on the visualforce page.
With Regards
Palak Agarwal
According to the docs for the standard controller:
--- snip ---
The maximum value for the optional scope parameter is 2,000. If set to a higher value, Salesforce chunks the records returned by the QueryLocator into smaller batches of up to 2,000 records.
If no size is specified with the optional scope parameter, Salesforce chunks the records returned by the QueryLocator into batches of 200.
--- snip ---
How can I specify the scope?
Ah - you are using query rather than query locator - sorry about that. In that case it should manage the full list you pass it.
What does your query look like?
I am creating a dynamic soql query on contact and then passing it into database.query().
Yeah, I figured that. Can you post an example of the generated query?
Hi below is the example of the query
Hmm. Do you really have 23,000 contacts matching that query? Seems like a lot to be associated with a single account.
Yes there are, I have run a report to check the actual number of records and that gave around 23000 records, matching the same query.
If you debug the list as soon as you have executed it, does it show 200 there (i.e. is it the query only returning that many or the controller doing something odd once it takes over)?
Yes query is returning 200 records.
Have you tried running the query in the developer console, to remove the controller from the picture.
yes it is returning 200 records only....
That sounds very much like on 200 records satisfy the query. Are you sure that the report you ran had exactly the same filter criteria?