I need to display over 1000 reports based on a search using a paginate. I get an error message when it tries to retrieve more than 1000 reports. (I'm thinking of using 'Next' and 'Previous' buttons to navigate from one set of records to another). Currently I'm using a string search but it's a problem when more than 1000 reports use same words in their names.

I tried using Standardset controller but it doesn't support for Reports, and Offset controller only works for 2000 reports. I'm thinking of any other way of using a custom pagination. Is there anyway of doing this ? Any help on this would be appreciated!

My Class

public with sharing class CreateFeedController
    public Data_Feed__c feed {get; set;}
    public Id reportId {get; set;}
    public String reportName {get; set;}
    public List<SelectOption> reportsList {get; set;}
    public List<DataSelectionRowWrapper> rows {get; set;}
    public DataSelectionRowWrapper headerRow {get; set;}
    public Integer selectedInt {get; set;}
    public User user {get; set;}

    public String retrievedWebServiceData{get; set;}

    public String reportCol {get; set;}
    public String reportRow {get; set;}

    public Boolean reportSelected {get; set;}
    public Boolean chatterSelected {get; set;}
    public Boolean webSelected {get; set;}

    private Reports.ReportResults report {get; set;}
    //private Map<String, Id> recordTypes = new Map<String, Id>();
    //private transient Map<String,Schema.RecordTypeInfo> recordTypes;

    public String selectedWS {get; set;}
    public String symbol {get; set;}

    public String ReportSearchString {get;set;}
    public Map<Id,Report> reportSearchResult {get;set;}
    public List<Report> reportList {get;set;}
    public String warningMessage {get;set;}
    public Boolean showTable {get;set;}
    public Report selectedReport {get;set;}
    public Id selectedReportId {get;set;}

    public Integer CountTotalRecords{get;set;}
    public String QueryString {get;set;}
    public Integer OffsetSize = 0;
    private Integer QueryLimit = 5;

    public CreateFeedController(ApexPages.StandardController stdCon)

    public CreateFeedController()

    private void init()
        feed = new Data_Feed__c();        

        //results = new Reports.ReportResults();
        reportsList = new List<SelectOption>();
        user = new User();

        retrievedWebServiceData = '';

        reportCol = '';
        reportRow = '';

        reportSelected = false;
        chatterSelected = false;
        webSelected = false;

public void searchReports()
        showTable = false;      
        reportList = new List<Report>(); //clearing the previous search results
        reportSearchResult = new Map<Id, Report>(); //clearing the previous search results for the data map
        selectedReport = new Report();
        if((ReportSearchString != null && ReportSearchString != '') && ReportSearchString.length() >= 3)
            reportSearchResult = new Map<Id, Report>([Select Id, Name From Report Where Name Like :'%'+ReportSearchString+'%' limit 1000]);

            warningMessage = 'No Result Found';
            if (reportSearchResult.size() == 0) ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'No Result Found'));

            warningMessage = 'Search text should have atleast 3 characters';
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Search text should have atleast 3 characters'));
            //ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'i.e: Search results can be improved by using several words or characters'));


        if(reportSearchResult != null && reportSearchResult.size() > 0)
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'NOTE: Search results can always be improved by using several words or characters'));
            showTable = true;
            reportList = reportSearchResult.values();
             showTable = false;


    public pageReference BackToCreateFeedPage()

        if(selectedReportId != null)
            reportId = selectedReportId;
            reportName = reportSearchResult.get(selectedReportId).Name;

        return Page.CreateFeed;

   public pageReference reset()
      showTable = false;
      this.ReportSearchString = '';
      this.warningMessage = '';
      return null;


My VF page,

<apex:page standardController="Data_Feed__c" extensions="CreateFeedController">
<apex:messages id="messagePanel"/>
<apex:pageMessages id="messagePanel2"/>
    <apex:form >
        <apex:pageBlock title="Please Search and Select a Source Report" id="pbBlock"  >
            <apex:pageBlockSection columns="1">
                <apex:pageBlockSectionItem >
                    <apex:outputPanel layout="block" Rendered="true" id="panelId" >
                        <apex:inputText value="{!ReportSearchString}" />
                        <apex:commandButton value="Search" action="{!searchReports}" reRender="ReportSearchResults,messagePanel2,messagePanel "/> &nbsp;&nbsp; 
                        <apex:commandButton value="Back" action="{!BackToCreateFeedPage}"/>&nbsp;
                        <apex:outputPanel style="padding:4.5px;" styleClass="btn" >
                            <apex:actionSupport event="onclick" action="{!reset}" rerender="pbBlock,messagePanel2" />
                <!-- <apex:commandButton value="Back" action="{!BackToCreateFeedPage}"/> -->
            <apex:pageBlockSection id="ReportSearchResults">
                <apex:outputText value="{!warningMessage}" rendered="{!!showTable}" />
                <apex:pageBlockTable value="{!reportList}" var="item" rendered="{!showTable}" id="tableId">
                    <apex:column headerValue="Report Name" >
                        <apex:commandLink value="{!item.Name}" action="{!BackToCreateFeedPage}">
                            <apex:param value="{!item.Id}" name="SelectedReport" assignTo="{!selectedReportId}" />


You must log in to answer this question.

Browse other questions tagged .