You need to sign in to do that
Don't have an account?
aaryan sri
Collection size 49,307 exceeds maximum size of 10,000..
Hi All,
I need to display more than 50000 in the page block table, Below is the code
VF page
<apex:page title="Trip Summary Details" sidebar="false" docType="html-5.0" tabStyle="Export_Trip_Details__tab" standardController="Trip_Summary__c" extensions="VFC01_ExportTripDetail" Readonly="true">
<apex:form >
<apex:pageMessages id="errors" />
<apex:pageBlock title="Export Trip details">
<apex:pageBlockSection title="Filters" columns="2" collapsible="false" >
<h1>Please choose a range of dates</h1>
<apex:inputHidden />
<apex:input type="date" value="{!startDate}" label="Start Date"/>
<apex:input type="date" value="{!endDate}" label="End Date"/>
<apex:inputText value="{!lastName}" label="Last Name"/>
<apex:inputText value="{!firstName}" label="First Name"/>
<apex:inputText value="{!userId}" label="User ID"/>
<apex:selectList value="{!country}" size="1" label="Country">
<apex:selectOption itemValue="US" itemLabel="United States"/>
<apex:selectOption itemValue="CA" itemLabel="Canada"/>
</apex:selectList>
<apex:inputHidden />
<apex:actionStatus id="actStatusId" >
<apex:facet name="start" >
<img src="{!$Resource.SMT_Loading}"/>
</apex:facet>
</apex:actionStatus>
<apex:commandButton status="actStatusId" reRender="trppanel" value="Get Results" action="{!search}"/>
</apex:pageBlockSection>
<apex:outputPanel id="trppanel">
<apex:pageBlockSection id="trpDetails" title="Results Trip Details" rendered="{!isResult}" collapsible="false" columns="1">
<apex:pageblockTable value="{!tripSummary}" var="a">
<apex:column value="{!a.Trip_Id__c}"/>
<apex:column value="{!a.First_Name__c}"/>
<apex:column value="{!a.Last_Name__c}"/>
<apex:column value="{!a.User_Id__c}"/>
<apex:column value="{!a.Submitted_Date__c}"/>
<apex:column value="{!a.Total_Business_Miles__c}"/>
<apex:column headerValue="Action" >
<apex:commandLink rerender="trppanel" value="Export To CSV" styleClass="btn" style="color:block;text-decoration:none" onclick="javascript:openPopupFocus('/apex/VFP02_ExportToCSV?id={!a.Trip_Id__c}&cty={!country}');"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller Class
public with sharing class Exportl{
private ApexPages.StandardController controller {get; set;}
public boolean isResult {get;set;}
public list <Trip_Summary__c> tripSummary {get;set;}
public Date startDate {get;set;}
public Date endDate {get;set;}
public string lastName {get;set;}
public string firstName {get;set;}
public string userId {get;set;}
public string country {get;set;}
private String searchquery{get;set;}
public Export() { }
public Export(ApexPages.StandardController controller) {
//initialize the stanrdard controller
this.controller = controller;
isResult = false;
startDate = System.Today();
endDate = System.Today();
}
public void search(){
boolean oneCond = false;
searchquery='select Trip_Id__c,Salesforce_User__c,First_Name__c, Last_Name__c, User_Id__c, Submitted_Date__c,Submitted_Datetime__c, Total_Business_Miles__c from Trip_Summary__c ';
if(!userId.equals('')){
searchquery = searchquery+'where User_Id__c =:userId';
oneCond=true;
}
if(!firstName.equals('')){
if(oneCond){
searchquery = searchquery+' AND First_Name__c =:firstName';
} else {
searchquery=searchquery+'where First_Name__c =:firstName';
oneCond=true;
}
}
if(!lastName.equals('')){
if(oneCond){
searchquery = searchquery+' AND Last_Name__c =:lastName';
} else {
searchquery=searchquery+'where Last_Name__c =:lastName';
oneCond=true;
}
}
if(!country.equals('')){
if(oneCond){
searchquery = searchquery+' AND Region_Code__c =:country';
} else {
searchquery=searchquery+'where Region_Code__c =:country';
oneCond=true;
}
}
if(startDate!=null && endDate!=null){
if(oneCond){
searchquery = searchquery+' AND Submitted_Date__c >= :startDate AND Submitted_Date__c <= :EndDate';
} else {
searchquery=searchquery+'where Submitted_Date__c >= :startDate AND Submitted_Date__c <= :EndDate';
oneCond=true;
}
}
tripSummary= Database.query(searchquery);
isResult = true;
}
}
I need to display more than 50000 in the page block table, Below is the code
VF page
<apex:page title="Trip Summary Details" sidebar="false" docType="html-5.0" tabStyle="Export_Trip_Details__tab" standardController="Trip_Summary__c" extensions="VFC01_ExportTripDetail" Readonly="true">
<apex:form >
<apex:pageMessages id="errors" />
<apex:pageBlock title="Export Trip details">
<apex:pageBlockSection title="Filters" columns="2" collapsible="false" >
<h1>Please choose a range of dates</h1>
<apex:inputHidden />
<apex:input type="date" value="{!startDate}" label="Start Date"/>
<apex:input type="date" value="{!endDate}" label="End Date"/>
<apex:inputText value="{!lastName}" label="Last Name"/>
<apex:inputText value="{!firstName}" label="First Name"/>
<apex:inputText value="{!userId}" label="User ID"/>
<apex:selectList value="{!country}" size="1" label="Country">
<apex:selectOption itemValue="US" itemLabel="United States"/>
<apex:selectOption itemValue="CA" itemLabel="Canada"/>
</apex:selectList>
<apex:inputHidden />
<apex:actionStatus id="actStatusId" >
<apex:facet name="start" >
<img src="{!$Resource.SMT_Loading}"/>
</apex:facet>
</apex:actionStatus>
<apex:commandButton status="actStatusId" reRender="trppanel" value="Get Results" action="{!search}"/>
</apex:pageBlockSection>
<apex:outputPanel id="trppanel">
<apex:pageBlockSection id="trpDetails" title="Results Trip Details" rendered="{!isResult}" collapsible="false" columns="1">
<apex:pageblockTable value="{!tripSummary}" var="a">
<apex:column value="{!a.Trip_Id__c}"/>
<apex:column value="{!a.First_Name__c}"/>
<apex:column value="{!a.Last_Name__c}"/>
<apex:column value="{!a.User_Id__c}"/>
<apex:column value="{!a.Submitted_Date__c}"/>
<apex:column value="{!a.Total_Business_Miles__c}"/>
<apex:column headerValue="Action" >
<apex:commandLink rerender="trppanel" value="Export To CSV" styleClass="btn" style="color:block;text-decoration:none" onclick="javascript:openPopupFocus('/apex/VFP02_ExportToCSV?id={!a.Trip_Id__c}&cty={!country}');"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller Class
public with sharing class Exportl{
private ApexPages.StandardController controller {get; set;}
public boolean isResult {get;set;}
public list <Trip_Summary__c> tripSummary {get;set;}
public Date startDate {get;set;}
public Date endDate {get;set;}
public string lastName {get;set;}
public string firstName {get;set;}
public string userId {get;set;}
public string country {get;set;}
private String searchquery{get;set;}
public Export() { }
public Export(ApexPages.StandardController controller) {
//initialize the stanrdard controller
this.controller = controller;
isResult = false;
startDate = System.Today();
endDate = System.Today();
}
public void search(){
boolean oneCond = false;
searchquery='select Trip_Id__c,Salesforce_User__c,First_Name__c, Last_Name__c, User_Id__c, Submitted_Date__c,Submitted_Datetime__c, Total_Business_Miles__c from Trip_Summary__c ';
if(!userId.equals('')){
searchquery = searchquery+'where User_Id__c =:userId';
oneCond=true;
}
if(!firstName.equals('')){
if(oneCond){
searchquery = searchquery+' AND First_Name__c =:firstName';
} else {
searchquery=searchquery+'where First_Name__c =:firstName';
oneCond=true;
}
}
if(!lastName.equals('')){
if(oneCond){
searchquery = searchquery+' AND Last_Name__c =:lastName';
} else {
searchquery=searchquery+'where Last_Name__c =:lastName';
oneCond=true;
}
}
if(!country.equals('')){
if(oneCond){
searchquery = searchquery+' AND Region_Code__c =:country';
} else {
searchquery=searchquery+'where Region_Code__c =:country';
oneCond=true;
}
}
if(startDate!=null && endDate!=null){
if(oneCond){
searchquery = searchquery+' AND Submitted_Date__c >= :startDate AND Submitted_Date__c <= :EndDate';
} else {
searchquery=searchquery+'where Submitted_Date__c >= :startDate AND Submitted_Date__c <= :EndDate';
oneCond=true;
}
}
tripSummary= Database.query(searchquery);
isResult = true;
}
}
Bhaswanthnaga vivek vutukuri