You need to sign in to do that
Don't have an account?
Arup Sarkar
System.LimitException: and Collection size error
Hi:
We have a List<Task> CallReportData in a controller (apex class) which queries a task object based on date parameters and return rows, which is then fed to a VF page rendered as PDF to display results. There is corresponding get method in the controller.
In VF we use the following
<apex:pageblockTable value="{!CallReportData}" var="task"> <apex:column value="{!task.Date__c}" /> </apex:pageblockTable>
Problem is when the number of records are more than 1000 I am getting the following error.
Collection size 1,695 exceeds maximum size of 1,000
I also loop within the main loop another SOQL which is giving me this error when the number of rows from main SOQL is more than 1000.
caused by: System.LimitException: Too many SOQL queries: 101
How to get past the above errors?
Regards,
Arup
I was able to get past 1000 record limitation and nested SOQL issue by a) Making a batch of 1000 records and returning it to the VF Page b) Removed the SOQL from within the for loop put it outside, retrieved the ID's in a SET and then used the SET in the IN clause of the query.
I got this info from a blog, I wish I copied the URL, but however here are the main blocks of the code.
Apex Class:
Corresponding VF page:
Modify the above code according to your needs, this is not a entire working code, just the idea how it is implemented.
Thanks all for your help.
All Answers
Hi Arup,
please provide the controller code also ..
For error - caused by: System.LimitException: Too many SOQL queries: 101
you need to take out the SOQL query outside the FOR loop
you are getting error - Collection size 1,695 exceeds maximum size of 1,000 because you cannot bind more than 1000 records to your visualforce controller.
To remove your first error apply limit to query to 1000 which returns the result in "CallReportData" and we need the code snippet to resolve too many SOQL exception. Am hoping there is a query in for loop.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
I was able to get past 1000 record limitation and nested SOQL issue by a) Making a batch of 1000 records and returning it to the VF Page b) Removed the SOQL from within the for loop put it outside, retrieved the ID's in a SET and then used the SET in the IN clause of the query.
I got this info from a blog, I wish I copied the URL, but however here are the main blocks of the code.
Apex Class:
Corresponding VF page:
Modify the above code according to your needs, this is not a entire working code, just the idea how it is implemented.
Thanks all for your help.
Found the URL, go to the end and search for Paul, it is his idea that I implemented, hope it helps everyone who are facing a similar issue.
http://boards.developerforce.com/t5/Visualforce-Development/Getting-around-1000-record-collection-size-limit-in/m-p/255905#M33279