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
Nicole LevyNicole Levy 

apex:pageBlockTable Collection size is size of all records in sObject, instead of just those returned by SOQL query

I have a <apex:pageBlockTable></apex:pageBlockTable> element that is looping over a variable in the page constructor. I have added `LIMIT 1000` to the end of the SOQL query and have confirmed the List<Asset> variable only has a size of 1000 using System.debug(). I keep getting this error on the actual visualforce page though:

Content cannot be displayed: Collection size 10,336 exceeds maximum size of 10,000.
This is the total number of records in the sObject Asset. I don't know why or how it's pulling all of them when the SOQL query that grabs records for the variable is only grabbing 1000 records. Thanks in advance if you have any ideas what might be the cause of this.
Best Answer chosen by Nicole Levy
Nicole LevyNicole Levy
The problem was that I had accidentally named a method in the APEX class as the getter for this particular list, and it was passing back a large collection.

All Answers

Nishant Prajapati 10Nishant Prajapati 10
Hi Nicole
Use SOQL For Loop to push data in List.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_loops_for_SOQL.htm
Nicole LevyNicole Levy
HI Nishant, that is what I am currently doing.
Nicole LevyNicole Levy
The problem was that I had accidentally named a method in the APEX class as the getter for this particular list, and it was passing back a large collection.
This was selected as the best answer