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
jobojobo 

SOQL - For Loop Results to VF-Page

Edit: probably this request does not make sense as more than 1000 items shouldn't be displayed on on page - instead i should use query more and display a "next 1000 items" link on the page

 

hi guys, i need a hint for displaying the results of a query with more than 1000 items. i browse them by doing a for loop but haven't found any example to bind them to a vf-page so far. i wonder if it actually can be done by PageReference Method (as i did with lists returned by queries with less results).

 

any example for such vfpage / class i missed?

 

 

 

 

 

 

Message Edited by jobo on 03-11-2009 06:39 AM
Best Answer chosen by Admin (Salesforce Developers) 
DowithforceDowithforce

Hi Ron,

 

I have successfully implemented setcontroller with prev/next but I like to fetch more than 10000 records  where ii is fail ( or more than 100000). what you told above is matching my requirement. Can you please tell me with an example?

 

 

 

 

All Answers

Ron HessRon Hess

 

first try setcontroller, that may be exactly what you want, details and examples in the docs.

 

or , if that does not work you could use a for loop to generate a list bound to 1000 items, then modify that loop to generate the first 1000, or the second 1000, or the third 1000 by skiping N lists of 1000.   The ony trick is to specify an order by clause so that the lists are consistent ( more or less) each time you skip ahead in the larger list.  When you get to the N*1000 record, bind that to the list for Visualforce to display.

 

where N is passed in on a query string param from next page url.

 

 

Message Edited by Ron Hess on 03-11-2009 09:52 AM
DowithforceDowithforce

Hi Ron,

 

I have successfully implemented setcontroller with prev/next but I like to fetch more than 10000 records  where ii is fail ( or more than 100000). what you told above is matching my requirement. Can you please tell me with an example?

 

 

 

 

This was selected as the best answer