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
Kathir DevanKathir Devan 

How to increase cpu time limit..

Hi friends,

 

Is it possible to increase cpu time limit speed in javascript,if its possible please give me suggestion.

 

 

Regards,

kathir

digamber.prasaddigamber.prasad

Hi,

 

You can't. Regarding your previous code let me know if you can discuss it over call, as its tough to help by looking just on code base.

Kathir DevanKathir Devan

Hi Digamber,

 

Please help me Digamber Prasad, what should i do,do i send my controller code now.

 

Regards,

kathir

Kathir DevanKathir Devan

HI digamber,

 

Here below my whole controller code.

part 1#
*********
// Class for Transaction Search.
Public class clsTransactionSearch
   {
    public string StartDate{get;set;}
    public string searchinput{get;set;}
    public static string strCheck{get;set;}
    public string SearchCountry{get;set;}
    public string EndDate{get;set;}
    public String[] grdData{get; set;}
    public string SearchText {get; set;}
    public Date chk{get; set;}
    public string onc {get; set;} 
    public boolean trantypePDF {get; set;} 
    public boolean trantypeFULL {get; set;}   
    string transactionPDF=''; 
    string transactionFULL ='';
    public transaction__c announceDate{get;set;}
    public decimal amountMin {get;set;}
    public decimal amountMax {get;set;}
    public boolean tranStatusPending {get; set;} 
    public boolean tranStatusClosed {get; set;} 
    public boolean tranStatusCancelled {get; set;} 
    string transactionStatus='';
    public boolean excludeAmount {get; set;}
    
    Integer queryLimit;
    Integer offset;
    public Boolean firstOff{set;get;}    // previous part
    public Boolean lastOff{set;get;}     // next part
    public String limits{set;get;}
    public Integer pageNumber{set;get;}
    public Integer listSize;    // for total contact size
  //paginationvariable declaration code end here
    List<Transaction__c> lstQuery;
  
    public integer count{get; set;}
    Transaction__c lstTransaction;
    public List<Transaction_Relationship__c> lstTransactionRel;
    string tId='';
    public string strShow{get; set;}
    public string url = ApexPages.currentPage().getURL();
    List< transaction__c > lstprofile = new List< transaction__c >();
    List< StaticResource > documentList=[select name from StaticResource  where Name='pdfimage'];
    string ur='/resource/1373007575000/pdfimage';
    string a= documentList[0].name;
    string finn='Financing';
    string maa='M&A';
    string emp=' ';
    string bank='Banking Tech';
    string pay='Payments Tech';
    string sec='Securities and Cap Mkts';
  //string ins='Insurance / Healthcare';
  //string hel='Insurance / Healthcare';
    string ins='Insurance Tech';
    string hel='Healthcare Tech';
    string fsbo='Financial BPO / IT Svcs';   
    string close='Closed';   
    string pen='Pending';
    string can='Cancelled';  
  //Constructor of Class.
     public clsTransactionSearch()
     {
      try
        { 
            system.debug('Startup@@@@@@@@@@@@@@@@@@@@@@@@@@');
            strShow='none';
            strCheck='NA';
            string key = ApexPages.currentPage().getParameters().get('keyword');
            system.debug('key :::::::::::::::::'+key );   
            
           //code for pagination start      
            firstOff = false;
            queryLimit = 75;
            offset = 0;
          //limits = '10';
            pageNumber = 1;
            
          //code for pagination end  
            tId= ApexPages.currentPage().getParameters().get('AccountId');  
            if( tId != null )
            {
                companyBuyerInv();
            }  
            else
            {
            announceDate=new transaction__c();
            if(key != null )
            {
               trantypePDF=false;
               trantypeFULL=false;
               tranStatusPending =false;
               tranStatusClosed =false;
               tranStatusCancelled =false;
               excludeAmount =false;
               if(!key.contains(';'))
               SearchText = key;
            else
            {
                SearchText ='';
                List<string> lstkeyqord=key.split(';');
                Map<string,string> mp=new  Map<string,string>();
                for(integer i=0;i<lstkeyqord.size();i++)
                {
                string[] arr=lstkeyqord[i].split(':');
                if(arr[0] != null && arr[0]!='')
                mp.put(arr[0],arr[1]);
                }
             if(mp.containsKey('Key'))
                SearchText = mp.get('Key');
             if(mp.containsKey('SD'))
             {
                    StartDate= mp.get('SD');
                    if(StartDate.Length() == 8)
                    StartDate=StartDate.substring(0,4)+'-'+StartDate.substring(4,6)+'-'+StartDate.substring(6,8);
             }
            if(mp.containsKey('ED'))
            {
                EndDate= mp.get('ED');
                if(EndDate.Length() == 8)
                EndDate=EndDate.substring(0,4)+'-'+EndDate.substring(4,6)+'-'+EndDate.substring(6,8);
            }
            if(mp.containsKey('AMi'))
                amountMin =decimal.valueof(mp.get('AMi'));
            else
                amountMin =decimal.valueof(0);
            if(mp.containsKey('AMa'))
                amountMax=decimal.valueof(mp.get('AMa'));
            else
                amountMax=decimal.valueof(0);
                if(mp.containsKey('TP'))
                {
                string TP= mp.get('TP');
                if(TP.contains('PDF'))
                trantypePDF=true;
                 }
               if(mp.containsKey('FU'))
                {
                string FU= mp.get('FU');
                if(FU.contains('FULL'))
                trantypeFULL=true;
                }
            
                if(mp.containsKey('TS'))
                {
                    string TransStatus= mp.get('TS');
                    if(TransStatus.contains('Pending'))
                    tranStatusPending =true;
                    if(TransStatus.contains('Closed'))
                    tranStatusClosed =true;
                    if(TransStatus.contains('Cancelled'))
                    tranStatusCancelled =true;
                }
                if(mp.containsKey('EX'))
                {
                    excludeAmount =true;
                }
              
            }
                BindGrid();
               
            }
            else
            { 
                BindGridOnLoad();
              
            }
           }
        }
        
       catch(Exception ex)
        {
            ApexPages.addMessages(ex);  
            system.debug('Constructor catch$______________$'+ ex);          
        }
     }     
//Used to bind the grid based on search criteria.
     public pagereference getData()
      {    
         //BindGridOnLoad();
           BindGrid();
           return null;
      }
      
   /* public void next()
    {
       
       offset += queryLimit;
       if(offset+queryLimit >= listSize) lastOff = false; 
       firstOff = true;
       pageNumber++;
       if(SearchText ==''|| SearchText=='null' )
       {
        BindGridOnLoad();
       }
       else if(SearchText !='')
       {
       BindGrid();
       
       }
    }*/
    
    public void next(){
        offset += queryLimit;
        if(offset+queryLimit >= listSize) lastOff = false;
        firstOff = true;
        pageNumber++;
    }
    
   /* public void previous()
    {
        if(offset-queryLimit <= 0)
        {
        offset = 0;
        firstOff = false;
        }
        else offset -= queryLimit;
        lastOff = true;
        pageNumber--;
        if(SearchText ==''|| SearchText =='null' )
        {
        BindGridOnLoad();
        
        }
        else if(SearchText !='')
        {
        BindGrid();
        }
    }*/
    
    public void previous()
    {
        if(offset-queryLimit <= 0)
        {
        offset = 0;
        firstOff = false;
        }
        else offset -= queryLimit;
        lastOff = true;
        pageNumber--;
    }
    
  /*  public void first()
    {
        offset = 0;
        firstOff = false;
        lastOff = true;
        pageNumber = 1;
        if(SearchText ==''|| SearchText =='null' )
        {
        BindGridOnLoad();
       
        }
        else if(SearchText !='')
        {
        BindGrid();
        }
    }*/
    
     public void first()
     {
        offset = 0;
        firstOff = false;
        lastOff = true;
        pageNumber = 1;
     }
    
   /* public void last()
    {
        if(Math.Mod(listSize,queryLimit) == 0)
        {
        offset = listSize-queryLimit;
        pageNumber = listSize/queryLimit;
        system.debug('offset$______________$'+offset);
        system.debug('pageNumber $______________$'+pageNumber );
        if(SearchText ==''|| SearchText ==null )
        {
        BindGridOnLoad();
        
        }
        else if(SearchText !='')
        {
        BindGrid();
       
        }
        }
        else
        {
        offset = (listSize/queryLimit)*queryLimit;
        pageNumber = (listSize/queryLimit)+1;
        if(SearchText ==''|| SearchText ==null )
        {
        BindGridOnLoad();
        
        }
        else if(SearchText !='')
        {
        BindGrid();
        
        }
        
        }
        lastOff = false;
        firstOff = true;
    }*/
    
    public void last(){
        // set page number of and offset
        if(Math.Mod(listSize,queryLimit) == 0)
        {
            offset = listSize-queryLimit;
            pageNumber = listSize/queryLimit;
        }
        else
        {
            offset = (listSize/queryLimit)*queryLimit;
            pageNumber = (listSize/queryLimit)+1;
        }
        
        lastOff = false;
        firstOff = true;
    }
    
  /*  public List<SelectOption> getItems()
    {
        List<SelectOption> options = new List<SelectOption>();
        
        options.add(new SelectOption('10','10'));
        options.add(new SelectOption('20','20'));
        options.add(new SelectOption('50','50'));
        options.add(new SelectOption('100','100'));
        return options;
    }*/
    // change query limit
    public void changeLimit()
    {
         //set query limit
        queryLimit = Integer.valueOf(limits);
        offset = 0;
        firstOff = false;
        // initialy check page more then 1 or not
        if(listSize > queryLimit) lastOff = true;
        else lastOff = false;
        // set page number
        pageNumber = 1;
    }
    
    // for show current record numbers
   
     
     
      public String getRecordInfo()
    {
        integer lastLimit;
        if(offset+queryLimit > listSize) 
        {
            lastLimit = listSize;
        }
        else if(offset+queryLimit <= listSize) 
        { 
        lastLimit = offset+queryLimit;
        }
        if(listSize >75)
        {
         return (offset+1) + ' - ' + lastLimit + ' of '+listSize;
        }
        else if(listSize<=75)
        {
          return  'Records Found :' +listSize;
        }
        return null;
    }
    
    
    // return total page number
    public Integer getTotalPage()
    {
        try
        {        
        if(Math.Mod(listSize,queryLimit) == 0) 
        return listSize/queryLimit;
        else 
        return (listSize/queryLimit)+1;
        }
        catch(Exception ex)
        {
         integer ss = 0;
            ApexPages.addMessages(ex);  
            system.debug('Get Total page catch$______________$'+ ex);   
            return  ss;      
        }
    }
    
    // for direct page switching
    public void pageNavigation()
    {
    
        if(Math.Mod(listSize,queryLimit) == 0 && pageNumber > listSize/queryLimit)
        pageNumber = listSize/queryLimit; 
        else if(pageNumber > (listSize/queryLimit)+1)
        pageNumber = (listSize/queryLimit)+1;
    
     // set offset according to pageNumber    
        if((pageNumber-1)*queryLimit < 0) offset = 0;
        else offset = (pageNumber-1)*queryLimit;    
        
        
        if(pageNumber == 1) firstOff = false;
        else if(pageNumber == 0) pageNumber = 1;
        else if(pageNumber > 1) firstOff = true;
    
     // user enter last number of pagenumber than deactive next navigator
        if(Math.Mod(listSize,queryLimit) == 0){
        if(pageNumber == listSize/queryLimit) lastOff = false;
        else lastOff = true;
        }
        else{
        if(pageNumber == (listSize/queryLimit)+1) lastOff = false;
        else lastOff = true;
        }
    }
    //pagination code end   
   

 Regards,

kathir

 

Kathir DevanKathir Devan

Part2#

************

 public void BindGrid()
    {  
         strShow='';      
         try
          { 
            
            if(SearchCountry == null || SearchCountry == '')
             {
              strCheck='NA';
             }
             else if(SearchText == '' || SearchText == null)
             {
                
                 if(strCheck.equals('Ch'))
                 {
                     SearchText = SearchCountry;
                     SearchCountry='';                     
                 }                
                 
                 strCheck='NA';
             }
             else
             {
                          
                if(strCheck.equals('Ch'))
                 {
                     SearchText = SearchCountry;
                 }                  
                 else
                     SearchText =SearchText ;
                 
                 
                  SearchCountry='';
                  strCheck='NA';
             }   
                
             Set<Id> setRecordTypeIds = new Set<Id>();
             Schema.DescribeSObjectResult d = Schema.SObjectType.Transaction_Relationship__c; 
             Map<String,Schema.RecordTypeInfo> rtMapByName = d.getRecordTypeInfosByName();
             setRecordTypeIds.add(rtMapByName.get('Buyer/Investor').getRecordTypeId());
             setRecordTypeIds.add(rtMapByName.get('Seller').getRecordTypeId());
             setRecordTypeIds.add(rtMapByName.get('IPO').getRecordTypeId());
             string QueryString='';
             grdData = new String[]{};
             set<id> transId = new set<id>();
             for(List<Transaction_Relationship__c> lstTransactinRelation : [Select t.Transaction__r.Id from Transaction_Relationship__c t where (t.RecordTypeId in: setRecordTypeIds and t.Transaction__r.Online__c ='Yes' and t.Transaction__c <> '')])
             {
             for(Transaction_Relationship__c d1 : lstTransactinRelation)
             {
              transId.add( d1.Transaction__r.Id);
             }
             }        
           
          /*string QueryString='';
            grdData = new String[]{};
            set<id> transId = new set<id>();
            List<Transaction_Relationship__c> lstTransactinRelation = [Select t.Transaction__r.Id from Transaction_Relationship__c t  where (( t.RecordType.Name='Buyer/Investor' or t.RecordType.Name='Seller' or t.RecordType.Name='IPO') and t.Transaction__r.Online__c ='Yes' and  t.Transaction__c <> '')];
            for(Transaction_Relationship__c d : lstTransactinRelation  )
             {   
                 transId.add( d.Transaction__r.Id);
             }*/
             
          //Query to display an transaction details
            string SearchQuery='Select t.Target__r.Id,t.Target__r.Name,t.Id,t.Amount__c, t.Announce_Date__c, t.Target__c, t.Target_Sector2__c, t.Transaction_Headline__c, t.Type2__c,t.Profile_Link__c  from Transaction__c t where (t.Id in : transId) ';
            system.debug('SearchQuery@@@@@@@@@@@@@@@@@@@@@@@@@@'+SearchQuery);
            if(SearchText == '$')
            {
                SearchText = '\'$';
            }
            if(SearchText != null || SearchText != '')
            { 
                if(trantypePDF == true)
                {
                
                    if(url == '/apex/transactionsearch' || url == '/apex/transactionsearch?var=mmf' || url =='/apex/transactionsearch?sub=aggmaf')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\') )';
                    }
                    else if(url =='/apex/transactionsearch?sub=Bankmaf')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\') )  and t.Target_Sector2__c LIKE :bank';
                    }
                    else if(url =='/apex/transactionsearch?sub=paymaf')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\') )  and t.Target_Sector2__c LIKE :pay';
                    }
                    else if(url =='/apex/transactionsearch?sub=secmaf')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + '   and ((t.Profile_Link__c  like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :sec';
                    }
                    else if(url =='/apex/transactionsearch?sub=insmaf')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :ins';
                    }
                    else if(url =='/apex/transactionsearch?sub=helmaf')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :hel';
                    }
                    else if(url =='/apex/transactionsearch?sub=fbpmaf')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + ' and ((t.Profile_Link__c  like \'%' + SearchText + '%\')) and t.Target_Sector2__c LIKE :fsbo';
                    }
                  //textbox search for transaction end here
                  //textbox search for MA start here
                   else  if(url =='/apex/masearch?var=ma' || url =='/apex/masearch?sub=aggma')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + ' and ((t.Profile_Link__c  like \'%' + SearchText + '%\') )   and  t.Type2__c LIKE :maa';
                    }
                    else  if(url =='/apex/masearch?sub=Bankma')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :bank';
                    }
                    else  if(url =='/apex/masearch?sub=payma')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :pay';
                    }
                    else if(url =='/apex/masearch?sub=secma')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + ' and ((t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :sec';
                    }
                    else if(url =='/apex/masearch?sub=insma')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :ins';
                    }
                     else if(url =='/apex/masearch?sub=helma')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :hel';
                    }
                    else  if(url =='/apex/masearch?sub=fbpma')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + ' and ((t.Profile_Link__c  like \'%' + SearchText + '%\')) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :fsbo';
                    }

 Regards,

kathir

Kathir DevanKathir Devan

Part3#

*********

//textbox search for MA end here
                  //textbox search for Financing start here
                    else if(url=='/apex/MAFinancing?var=fin' || url=='/apex/MAFinancing?sub=aggfin')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + ' and ((t.Profile_Link__c  like \'%' + SearchText + '%\')) and  t.Type2__c LIKE :finn';
                    }
                    else if(url =='/apex/MAFinancing?sub=Bankfin')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :bank';
                    }
                      else if(url =='/apex/MAFinancing?sub=payfin')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :pay';
                    }
                    else if(url =='/apex/MAFinancing?sub=secfin')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :sec';
                    }
                    else if(url =='/apex/MAFinancing?sub=insfin')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :ins';
                    }
                     else if(url =='/apex/MAFinancing?sub=helfin')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery + 'and ((t.Profile_Link__c  like \'%' + SearchText + '%\')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :hel';
                    }
                    else if(url =='/apex/MAFinancing?sub=fbpfin')
                    {
                    SearchText= 'pdf';
                    SearchQuery = SearchQuery +'and ((t.Profile_Link__c  like \'%' + SearchText + '%\')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :fsbo';
                    }
                    if(SearchText != null && SearchText != '')
                    QueryString =QueryString + ';' +'Key:' + SearchText;
              
                }
                
               else if(trantypeFULL== true)
                {
                    if(url == '/apex/transactionsearch' || url == '/apex/transactionsearch?var=mmf' || url =='/apex/transactionsearch?sub=aggmaf')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') )';
                    }
                    else if(url =='/apex/transactionsearch?sub=Bankmaf')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :bank';
                    }
                     else if(url =='/apex/transactionsearch?sub=paymaf')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :pay';
                    }
                    else if(url =='/apex/transactionsearch?sub=secmaf')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :sec';
                    }
                    else if(url =='/apex/transactionsearch?sub=insmaf')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :ins';
                    }
                    else if(url =='/apex/transactionsearch?sub=helmaf')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :hel';
                    }
                    else if(url =='/apex/transactionsearch?sub=fbpmaf')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') )  and t.Target_Sector2__c LIKE :fsbo';
                    }
                  //textbox search for transaction end here
                  //textbox search for MA start here
                   else  if(url =='/apex/masearch?var=ma' || url =='/apex/masearch?sub=aggma')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :maa';
                    } 
                    else if(url =='/apex/masearch?sub=Bankma')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') )  and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :bank';
                    }
                     else if(url =='/apex/masearch?sub=payma')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') )  and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :pay';
                    }
                    else if(url =='/apex/masearch?sub=secma')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :sec';
                    }
                    else if(url =='/apex/masearch?sub=insma')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :ins';
                    }
                    else if(url =='/apex/masearch?sub=helma')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :hel';
                    }
                    else  if(url =='/apex/masearch?sub=fbpma')
                    {
                    SearchQuery = SearchQuery + 'and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :fsbo';
                    }
                  //textbox search for MA end here
                  //textbox search for Financing start here
                    else if(url=='/apex/MAFinancing?var=fin' || url=='/apex/MAFinancing?sub=aggfin')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :finn';
                    }
                   else  if(url =='/apex/MAFinancing?sub=Bankfin')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :bank';
                    }
                     else  if(url =='/apex/MAFinancing?sub=payfin')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :pay';
                    }
                    else if(url =='/apex/MAFinancing?sub=secfin')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') )  and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :sec';
                    }
                    else if(url =='/apex/MAFinancing?sub=insfin')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :ins';
                    }
                    else if(url =='/apex/MAFinancing?sub=helfin')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :hel';
                    }
                    else if(url =='/apex/MAFinancing?sub=fbpfin')
                    {
                    SearchQuery = SearchQuery + '   and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\') or (t.PR_Search__c like \'%' + SearchText + '%\') or (t.Highlight_Search__c like \'%' + SearchText + '%\') or (t.Target__r.Name like \'%' + SearchText + '%\')or (t.Profile_Link__c  like \'%' + SearchText + '%\') ) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :fsbo';
                    }
                    if(SearchText != null && SearchText != '')
                    QueryString =QueryString + ';' +'Key:' + SearchText;
              
               }
             
               else
               {   
                  //textbox search for MA and Financingstart here
                    if(url == '/apex/transactionsearch' || url == '/apex/transactionsearch?var=mmf' || url =='/apex/transactionsearch?sub=aggmaf')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\')  or (t.Target__r.Name like \'%' + SearchText + '%\') )';
                    }
                    else if(url =='/apex/transactionsearch?sub=Bankmaf')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\')  or (t.Target__r.Name like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :bank';
                    }
                    else if(url =='/apex/transactionsearch?sub=paymaf')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\')  or (t.Target__r.Name like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :pay';
                    }
                    else if(url =='/apex/transactionsearch?sub=secmaf')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\')  or (t.Target__r.Name like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :sec';
                    }
                    else if(url =='/apex/transactionsearch?sub=insmaf')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\')  or (t.Target__r.Name like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :ins';
                    }
                    else if(url =='/apex/transactionsearch?sub=helmaf')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\')  or (t.Target__r.Name like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :hel';
                    }
                    else if(url =='/apex/transactionsearch?sub=fbpmaf')
                    {
                    SearchQuery = SearchQuery + ' and ((t.Transaction_Headline__c like \'%' + SearchText + '%\') or (t.Buyer_Investors__c like \'%' + SearchText + '%\') or  (t.Target_Company__c like \'%' + SearchText + '%\')  or (t.Target__r.Name like \'%' + SearchText + '%\') ) and t.Target_Sector2__c LIKE :fsbo';
                    }

 Regards,

kathir

Kathir DevanKathir Devan

Part4#

**********

//advance search in checkbox            
            transactionPDF='';
            transactionStatus='';
            if(tranStatusPending)
            {
                    if(transactionStatus=='')
                    transactionStatus='\'Pending\'';
                    else
                    transactionStatus=transactionStatus+','+'\'Pending\'';
            }
            if(tranStatusClosed)
            {
                    if(transactionStatus=='')
                    transactionStatus='\'Closed\'';
                    else
                    transactionStatus=transactionStatus+','+'\'Closed\'';
            }
            if(tranStatusCancelled)
            {
                    if(transactionStatus=='')
                    transactionStatus='\'Cancelled\'';
                    else
                    transactionStatus=transactionStatus+','+'\'Cancelled\'';
            }
          
           //check the condition of advance search
             List<Transaction__c> que = Database.query(SearchQuery);
             listSize = que.size();
             system.debug('_______llllllllll__________'+listSize +offset+queryLimit);
             if(listSize > offset+queryLimit)
             lastOff = true;
             else 
             lastOff = false;
             if((transactionStatus != null) ||  ( StartDate != null) || (EndDate != null) || (excludeAmount != true) || (amountMin != null) || (amountMax != null))
             {
                    if( transactionStatus != null && transactionStatus != '')
                    {
                    SearchQuery = SearchQuery+ ' and(t.Transaction_status__c in ('+transactionStatus+'))';
                    QueryString=QueryString +';' +'TS:'+ transactionStatus;
                    }
                    if( StartDate != null && EndDate != null && StartDate != '' && EndDate != '' )
                    {
                    if(url == '/apex/transactionsearch' || url == '/apex/transactionsearch?var=mmf' || url =='/apex/transactionsearch?sub=aggmaf')
                    {
                     SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+'))';
                    }
                    else if(url =='/apex/transactionsearch?sub=Bankmaf')
                    {
                  
                    SearchQuery = SearchQuery + ' and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and t.Target_Sector2__c LIKE :bank';
                    }
                     else if(url =='/apex/transactionsearch?sub=paymaf')
                    {
                  
                    SearchQuery = SearchQuery + ' and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and t.Target_Sector2__c LIKE :pay';
                    } 
                    else if(url =='/apex/transactionsearch?sub=secmaf')
                    {
                    
                    SearchQuery = SearchQuery + ' and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and t.Target_Sector2__c LIKE :sec';
                    }
                    else if(url =='/apex/transactionsearch?sub=insmaf')
                    {
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and t.Target_Sector2__c LIKE :ins';
                    }
                    else if(url =='/apex/transactionsearch?sub=helmaf')
                    {
                   
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and t.Target_Sector2__c LIKE :hel';
                    }
                    else if(url =='/apex/transactionsearch?sub=fbpmaf')
                    {
                   
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and t.Target_Sector2__c LIKE :fsbo';
                    }
                  //textbox search for transaction end here
                  //textbox search for MA start here
                    else  if(url =='/apex/masearch?var=ma' || url =='/apex/masearch?sub=aggma')
                    {
                    
                    SearchQuery = SearchQuery + ' and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+'))  and  t.Type2__c LIKE :maa';
                    }
                    else  if(url =='/apex/masearch?sub=Bankma')
                    {
                    
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :bank';
                    }
                    else  if(url =='/apex/masearch?sub=payma')
                    {
                    
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :pay';
                    }
                    
                    else if(url =='/apex/masearch?sub=secma')
                    {
                   
                    SearchQuery = SearchQuery + ' and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :sec';
                    }
                    else if(url =='/apex/masearch?sub=insma')
                    {
                    
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :ins';
                    }
                    else if(url =='/apex/masearch?sub=helma')
                    {
                    
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :hel';
                    }
                    else  if(url =='/apex/masearch?sub=fbpma')
                    {
                    
                    SearchQuery = SearchQuery + ' and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :maa and t.Target_Sector2__c LIKE :fsbo';
                    }
                  //textbox search for MA end here
                  //textbox search for Financing start here
                    else if(url=='/apex/MAFinancing?var=fin' || url=='/apex/MAFinancing?sub=aggfin')
                    {
                    
                    SearchQuery = SearchQuery + ' and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :finn';
                    }
                    else if(url =='/apex/MAFinancing?sub=Bankfin')
                    {
                    
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :bank';
                    }
                    else if(url =='/apex/MAFinancing?sub=payfin')
                    {
                    
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :pay';
                    }
                    else if(url =='/apex/MAFinancing?sub=secfin')
                    {
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :sec';
                    }
                    else if(url =='/apex/MAFinancing?sub=insfin')
                    {
                   
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :ins';
                    }
                    else if(url =='/apex/MAFinancing?sub=helfin')
                    {
                   
                    SearchQuery = SearchQuery + 'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :hel';
                    }
                    else if(url =='/apex/MAFinancing?sub=fbpfin')
                    {
                   
                    SearchQuery = SearchQuery +'and  ((t.Announce_Date__c >= '+StartDate+') and (t.Announce_Date__c <= '+EndDate+')) and  t.Type2__c LIKE :finn and t.Target_Sector2__c LIKE :fsbo';
                    } 
                    QueryString=QueryString +';' +'SD:'+ StartDate.replace('-','') + ';'+ 'ED:'+ EndDate.replace('-','') ;
                    }
                    if( excludeAmount == true)
                    {
                    SearchQuery = SearchQuery + ' and (t.Amount__c > 0) ';
                    QueryString=QueryString +';' +'EX:'+ excludeAmount ;
                    }
                    if((amountMax != 0 &&  amountMin == 0) || (amountMax != 0))
                    {
                    QueryString=QueryString +';' +'AMi:'+ amountMin + ';' + 'AMa:'+ amountMax ;
                    SearchQuery = SearchQuery + ' and ((t.Amount__c >= '+(amountMin==null?0:amountMin)+' ) and (t.Amount__c <= '+(amountMax==null?0:amountMax)+' )) ';
                    }
                    SearchQuery = SearchQuery + ' ORDER BY t.Announce_Date__c Desc LIMIT :queryLimit  OFFSET :offset ';
                    system.debug('_____________'+SearchQuery );
             }
            
           

 Regards,

kathir

Kathir DevanKathir Devan

Part5#

******

 for(List<Transaction__c> lstTransaction : Database.query(SearchQuery))
           {    
           for(Transaction__c e : Database.query(SearchQuery))
             {                 
                 DateTime dte = e.Announce_Date__c;
                 string BuyerInvestor='';
                 string str=QueryString.replace('\'','');
                 if(e.Target__r.Name =='null' || e.Target__r.Name ==null )
                 e.Target__r.Name = '';
                
                 e.Transaction_Headline__c = SpecialCharHandler(e.Transaction_Headline__c);
                 if( e.Target__r.Name !='' ||  e.Target__r.Name !=null )
                 e.Target__r.Name  = SpecialCharHandler(e.Target__r.Name );
                   
                 if(e.Profile_Link__c=='null' || e.Profile_Link__c==null )
                 e.Profile_Link__c= '';
                 if( e.Profile_Link__c != '' ||  e.Profile_Link__c != null)
                 e.Profile_Link__c = SpecialCharHandler(e.Profile_Link__c);
                 
                 string RltdCompany = '';
                 string strtransId = e.Id;
                 string strprofile = e.Profile_Link__c;
                 integer countRelCompany = 0;
                 
                  
               /*for(Transaction_Relationship__c f : [Select r.Related_Company_Id__c,r.Related_Company_Name__c from Transaction_Relationship__c r  where r.Transaction__r.Id =:strtransId and r.RecordType.Name = 'Buyer/Investor' order by r.Related_Company_Name__c asc])
                 {
                 string s = ((f.Related_Company_Name__c == null || f.Related_Company_Name__c =='')?'':f.Related_Company_Name__c) ;
                 if( s != null && s != '')
                 {
                 s = SpecialCharHandler(s);
                 RltdCompany = RltdCompany + '<a target=\'_parent\' href=\'transactionsearch?AccountId='+f.Related_Company_Id__c +'\'>' + s + '</a>' + ';  ';
                 countRelCompany = countRelCompany +1;
                 }
                 }*/
                 
                 if( countRelCompany != 0)
                 {
                 RltdCompany = RltdCompany.substring(0,RltdCompany.length()-3);
                 }
               //Insert data into the grid
                 if(e.Amount__c == 0.00 || e.Amount__c == NULL )
                    {
                        string s ='';
                        if(str != null && str != '')  
                        {
                           if(e.Profile_Link__c=='null'|| e.Profile_Link__c==null || e.Profile_Link__c=='')// to check the pdf link is empty 
                            {
                              grdData.add('["'+ dte.format('MM/dd/yyyy') +  '","' + ((e.Type2__c == null || e.Type2__c == '')?'':e.Type2__c) + '", "'+'<a target=\'_parent\' href=\'TransactionDetail?id='+ e.Id +'&keyword='+str+'\'>' + ((e.Transaction_Headline__c == null || e.Transaction_Headline__c == '')?'':e.Transaction_Headline__c)+'</a>' + '", "'+  '<a target=\'_parent\' href=\'TransactionSearch?AccountId='+e.Target__r.Id +'\'>' + e.Target__r.Name + '</a>' + '","'+ RltdCompany + '", "' + e.Target_Sector2__c + '","'+ s + '","'+  '"]');  
                            }
                            else if(e.Profile_Link__c!='null'|| e.Profile_Link__c!=null || e.Profile_Link__c!='')// to check the pdf link is  not  empty 
                            {
                              grdData.add('["' + dte.format('MM/dd/yyyy') +  '","' + ((e.Type2__c == null || e.Type2__c == '')?'':e.Type2__c) + '", "'+ '<a target=\'_parent\' href=\'TransactionDetail?id='+ e.Id +'&keyword='+str+'\'>' +((e.Transaction_Headline__c == null || e.Transaction_Headline__c == '')?'':e.Transaction_Headline__c)+'</a>'+  '<h5>'+ '(FT Partners profile Available)'+'</h5> ' + '", "'+  '<a target=\'_parent\' href=\'TransactionSearch?AccountId='+e.Target__r.Id +'\'>' + e.Target__r.Name + '</a>' + '","'+ RltdCompany+ '", "' + e.Target_Sector2__c + '","'+ s + '"]');  
                            }
                        }
                        else
                        {                        
                            if(e.Profile_Link__c=='null'|| e.Profile_Link__c==null || e.Profile_Link__c=='') // to check the pdf link is empty 
                             {
                               grdData.add('["' + dte.format('MM/dd/yyyy') +  '","' + ((e.Type2__c == null || e.Type2__c == '')?'':e.Type2__c) + '", "'+ '<a target=\'_parent\' href=\'TransactionDetail?id='+ e.Id +'\'>' +((e.Transaction_Headline__c == null || e.Transaction_Headline__c == '')?'':e.Transaction_Headline__c) +'</a>'+ '", "'+  '<a target=\'_parent\' href=\'TransactionSearch?AccountId='+e.Target__r.Id +'\'>' + e.Target__r.Name + '</a>' + '","'+ RltdCompany + '","' + e.Target_Sector2__c + '","' + s + '" ]');  
                             }
                            else if(e.Profile_Link__c !='null'|| e.Profile_Link__c !=null || e.Profile_Link__c !='')// to check the pdf link is not empty 
                             {
                               grdData.add('["'+ dte.format('MM/dd/yyyy') +  '","' + ((e.Type2__c == null || e.Type2__c == '')?'':e.Type2__c) + '", "'+'<a target=\'_parent\' href=\'TransactionDetail?id='+ e.Id +'\'>' + ((e.Transaction_Headline__c == null || e.Transaction_Headline__c == '')?'':e.Transaction_Headline__c)+'</a>'+  '<h5> '+'(FT Partners profile Available) '+'</h5> ' + '", "'+  '<a target=\'_parent\' href=\'TransactionSearch?AccountId='+e.Target__r.Id +'\'>' + e.Target__r.Name + '</a>' + '","'+ RltdCompany + '","' + e.Target_Sector2__c + '","' + s + '"]');  
                             }
                         }
                      }  
                  
                       else
                       { 
                            if(str != null && str != '')  
                            {     
                            if(e.Profile_Link__c=='null'|| e.Profile_Link__c==null || e.Profile_Link__c=='')// to check the pdf link is empty 
                            {               
                              grdData.add('["'+ dte.format('MM/dd/yyyy') + '","' +  ((e.Type2__c == null || e.Type2__c == '')?'':e.Type2__c) + '", "'+'<a target=\'_parent\' href=\'TransactionDetail?id='+ e.Id +'&keyword='+str+'\'>' + ((e.Transaction_Headline__c == null || e.Transaction_Headline__c == '')?'':e.Transaction_Headline__c)+'</a>' + '", "'+  '<a target=\'_parent\' href=\'TransactionSearch?AccountId='+e.Target__r.Id +'\'>' + e.Target__r.Name + '</a>' + '","'+ RltdCompany + '","' + e.Target_Sector2__c + '","'+ e.Amount__c   + '","'+  ''+ '"]');  
                            }
                            else if(e.Profile_Link__c !='null'|| e.Profile_Link__c !=null || e.Profile_Link__c !='')// to check the pdf link is empty 
                            {               
                              grdData.add('["'+ dte.format('MM/dd/yyyy') + '","' + ((e.Type2__c == null || e.Type2__c == '')?'':e.Type2__c) + '", "'+ '<a target=\'_parent\' href=\'TransactionDetail?id='+ e.Id +'&keyword='+str+'\'>'+ ((e.Transaction_Headline__c == null || e.Transaction_Headline__c == '')?'':e.Transaction_Headline__c)+'</a>'+  '<h5> '+ '(FT Partners profile Available) '+'</h5>' + '", "'+  '<a target=\'_parent\' href=\'TransactionSearch?AccountId='+e.Target__r.Id +'\'>' + e.Target__r.Name + '</a>' + '","'+ RltdCompany + '","' + e.Target_Sector2__c + '","'+ e.Amount__c   + '"]');  
                            }                   
                        }
                       else
                        {                          
                            if(e.Profile_Link__c=='null'|| e.Profile_Link__c==null || e.Profile_Link__c=='')// to check the pdf link is empty 
                            {               
                              grdData.add('["' + dte.format('MM/dd/yyyy') +  '","' + ((e.Type2__c == null || e.Type2__c == '')?'':e.Type2__c) + '", "'+'<a target=\'_parent\' href=\'TransactionDetail?id='+ e.Id +'\'>' + ((e.Transaction_Headline__c == null || e.Transaction_Headline__c == '')?'':e.Transaction_Headline__c) + '</a>'+ '", "'+  '<a target=\'_parent\' href=\'TransactionSearch?AccountId='+e.Target__r.Id +'\'>' + e.Target__r.Name + '</a>' + '","'+ RltdCompany + '","' + e.Target_Sector2__c + '","'+ e.Amount__c + '"]');  
                            }
                            else if(e.Profile_Link__c!='null'|| e.Profile_Link__c!=null || e.Profile_Link__c!='')// to check the pdf link is empty 
                            { 
                              grdData.add('["'+ dte.format('MM/dd/yyyy')  +  '","' + ((e.Type2__c == null || e.Type2__c == '')?'':e.Type2__c) + '", "'+'<a target=\'_parent\' href=\'TransactionDetail?id='+ e.Id +'\'>' + ((e.Transaction_Headline__c == null || e.Transaction_Headline__c == '')?'':e.Transaction_Headline__c)+ '</a>'+  '<h5> '+'(FT Partners profile Available) '+'</h5>' + '", "'+  '<a target=\'_parent\' href=\'TransactionSearch?AccountId='+e.Target__r.Id +'\'>' + e.Target__r.Name + '</a>' + '","'+ RltdCompany + '","' + e.Target_Sector2__c + '","'+ e.Amount__c + '"]');   
                            } 
                         }
                      }
                     
                  }
            
              if(grdData.size() == 0)
               {
                   grdData.add('["","","","No Transactions Found","","","",""]'); 
               }
             
            }
          }
        catch(Exception ex)
        {
          grdData = new String[]{}; 
          grdData.add('["","","","No Transactions Found","","","",""]');   
          ApexPages.addMessages(ex);
          system.debug('Bind grid catch$______________$'+ ex);
       }
   }
   
   // BindGrid() fun end here

 Regards,

kathir

Kathir DevanKathir Devan

Part6#

*********

public void BindGridOnLoad()
      {
        try
          {
                 
           grdData = new String[]{};
            set<id> transId = new set<id>();
            List<Transaction_Relationship__c> lstRelationship = [Select t.Transaction__r.Id,t.Related_Company_Name__c from Transaction_Relationship__c t  where ( ( t.RecordType.Name='Buyer/Investor' or t.RecordType.Name='Seller' or t.RecordType.Name='IPO') and t.Transaction__r.Online__c = 'Yes' and  t.Transaction__c <> '' ) ORDER BY t.Transaction__r.Announce_Date__c Desc ];
            
            for(Transaction_Relationship__c d : lstRelationship)
            {   
            transId.add( d.Transaction__r.Id);
            system.debug('d.Transaction__r.Id @@@@@@@@@@@@@@@@@@@@@@@@@@'+d.Transaction__r.Id);
            }
          //lstRelationship = null;
            string load='Select t.Target__r.Id,t.Target__r.Name,t.Id,t.Amount__c, t.Announce_Date__c, t.Target__c, t.Target_Sector2__c, t.Transaction_Headline__c, t.Type2__c,t.Profile_Link__c from Transaction__c t where t.Id IN : transId ';
            string res = load;
             if(url  == '/apex/transactionsearch'  ||  url == '/apex/transactionsearch?var=mmf' || url == '/apex/transactionsearch?sub=aggmaf')
                {
                    load+='and (t.Type2__c LIKE :maa or t.Type2__c LIKE :finn) ORDER BY t.Announce_Date__c Desc  LIMIT :queryLimit  OFFSET :offset ';
                    res+= 'and (t.Type2__c LIKE :maa or t.Type2__c LIKE :finn) ORDER BY t.Announce_Date__c Desc';
              
               }else
               //------------Aggregate FinTech Transactions-------------------
                if(url == '/apex/MAFinancing?sub=aggfin'  || url  == '/apex/MAFinancing?var=fin' )
               {
                  load+='and t.Type2__c LIKE :finn ORDER BY t.Announce_Date__c Desc LIMIT :queryLimit  OFFSET :offset ';
                  res+='and t.Type2__c LIKE :finn ORDER BY t.Announce_Date__c Desc';
                }
                else if(url  == '/apex/masearch?sub=aggma' || url  == '/apex/masearch?var=ma')
                {
                    load+='and t.Type2__c LIKE :maa ORDER BY t.Announce_Date__c Desc  LIMIT :queryLimit  OFFSET :offset';
                    res+='and t.Type2__c LIKE :maa ORDER BY t.Announce_Date__c Desc';
                
                }
                 //aggregateResult res=[Select COUNT(t.Id) cnt  from Transaction__c t where t.Id in : transId];
               //system.debug('count$______________$'+res );  
              //listSize = Integer.valueOf(res.get('cnt'));
             //system.debug('count$______________$'+listSize );  
              lstQuery = null;
              lstQuery  = Database.query(res);
              listSize = lstQuery.size();
              if(listSize > offset+queryLimit)
              lastOff = true;
              else 
              lastOff = false;
              lstQuery = null;
            
               lstQuery = Database.query(load);
         
                for(Transaction__c e : lstQuery )  
                {
                DateTime dte = e.Announce_Date__c;                               
                e.Transaction_Headline__c = SpecialCharHandler(e.Transaction_Headline__c);
                if(e.Target__r.Name =='null' || e.Target__r.Name==null )
                e.Target__r.Name = '';
                if( e.Target__r.Name != '' ||  e.Target__r.Name != null)
                e.Target__r.Name = SpecialCharHandler(e.Target__r.Name);
                if(e.Profile_Link__c=='null' || e.Profile_Link__c==null )
                e.Profile_Link__c= '';
                if( e.Profile_Link__c != '' ||  e.Profile_Link__c != null)
                e.Profile_Link__c = SpecialCharHandler(e.Profile_Link__c);
                string RltdCompany = '';
                string strtransId = e.Id;
                string strprofile = e.Profile_Link__c;
                integer countRelCompany = 0;
                
                List<Transaction_Relationship__c> lstTransRel = [Select r.Related_Company_Id__c,r.Related_Company_Name__c from Transaction_Relationship__c r  where r.Transaction__r.Id =:strtransId and r.RecordType.Name = 'Buyer/Investor' order by r.Related_Company_Name__c asc];                                   
               /* for(Transaction_Relationship__c f : lstTransRel)
                {                       
                string s = ((f.Related_Company_Name__c == null || f.Related_Company_Name__c =='')?'':f.Related_Company_Name__c) ;
                if( s != null && s != '')
                {
                s = SpecialCharHandler(s);
                RltdCompany = RltdCompany + '<a target=\'_parent\' href=\'transactionsearch?AccountId='+f.Related_Company_Id__c +'\'>' + s + '</a>' + ';  ';
                countRelCompany = countRelCompany +1;
                }                       
                }*/
               
                if( countRelCompany != 0)
                {
                 RltdCompany = RltdCompany.substring(0,RltdCompany.length()-3);                      
                }                        
              //Insert data into the grid
                
                if(e.Amount__c == 0.00 || e.Amount__c == NULL  )
                {
                    string s ='';
                    if(SearchText != null)
                    {
                         if(e.Profile_Link__c=='null'|| e.Profile_Link__c==null || e.Profile_Link__c=='')// to check the pdf link is empty 
                        {
                        grdData.add('["' + dte.format('MM/dd/yyyy') +  '","' + ((e.Type2__c == null || e.Type2__c == '')?'':e.Type2__c) + '", "'+'<a target=\'_parent\' href=\'TransactionDetail?id='+ e.Id +'&keyword='+SearchText+'\'>' + ((e.Transaction_Headline__c == null || e.Transaction_Headline__c == '')?'':e.Transaction_Headline__c)+'</a>' + '", "'+  '<a target=\'_parent\' href=\'TransactionSearch?AccountId='+e.Target__r.Id +'\'>' + e.Target__r.Name + '</a>' + '","'+ RltdCompany + '", "' + e.Target_Sector2__c + '","'+ s + '"]');  
                        }
                        else if(e.Profile_Link__c!='null'|| e.Profile_Link__c !=null || e.Profile_Link__c !='')// to check the pdf link is  not  empty 
                        {
                        grdData.add('["'+ dte.format('MM/dd/yyyy') +  '","' + ((e.Type2__c == null || e.Type2__c == '')?'':e.Type2__c) + '", "'+ '<a target=\'_parent\' href=\'TransactionDetail?id='+ e.Id +'&keyword='+SearchText+'\'>' +((e.Transaction_Headline__c == null || e.Transaction_Headline__c == '')?'':e.Transaction_Headline__c)+'</a>' +  '<h5> '+ '(FT Partners profile Available) '+'</h5>'+ '", "'+  '<a target=\'_parent\' href=\'TransactionSearch?AccountId='+e.Target__r.Id +'\'>' + e.Target__r.Name + '</a>' + '","'+ RltdCompany + '", "' + e.Target_Sector2__c + '","'+ s + '"]');  
                        }
                    }
        

 Regards,

kathir

Kathir DevanKathir Devan

Part7#

**************

  public static String doFormatting(Decimal val, String osep, String nsep)
        {
            String s, tmp; Integer i = 6;
            s = val.setScale(2).toPlainString().replace(osep, nsep);
            while(s.length() > i)
            {
                tmp = s.substring(0, s.length() - i) + osep + s.substring(s.length() - i);
                s = tmp;
                i += 4;
            }
            return s;
        }
     
     //Method to Handle the special characters in the grid  
      public string SpecialCharHandler(string s)
      {
        s = s.replace('<br>','').replace('"','&#34;').replace('<','&#60;').replace('>','&gt;').replace('\'','&#39;').replace('/','&#47;').replace('^','&#94;').replace('_','&#95;').replace('`','&#96;').replace('~','&#126;').replace('$','&#36;').replace('!','&#33;').replace('%','&#37;').replace('*','&#42;').replace('?','&#63;').replace(':','&#58;').replace('|','&#124;').replace('@','&#64;').replace('+','&#43;').replace('=','&#61;').replace('(','&#40;').replace(')','&#41;').replace('[','&#91;').replace(']','&#93;').replace('{','&#123;').replace('}','&#125;').replace('\\','&#92;').replace('€','&#128;').replace('£','&#163;').replace('•','&#149;');  
           return s;
      }
      
      //Method for the company and Buyer Investor search from the detail page.
      public void companyBuyerInv()
      {  
        strShow=''; 
        SearchText = '';
        try
        {
             string strId = '';
             system.debug('tid'+tid);            
             strId = tId;
             system.debug('tId block');            
             system.debug('strId '+strId );
             if(strId != null || strId != '' )
             {              
               strId = strId.substring(0,15);
              
               lstTransactionRel=[Select  t.Transaction__r.profile_Link__c,t.Related_Company_Name__c,t.Transaction__r.Target__r.Name,t.Transaction__r.Target__r.Id,t.RecordTypeId, t.RecordType.Name,t.Transaction__r.Id,t.Target_Relationship__c, t.Target_Relationship__r.Id, t.Transaction__c, t.Transaction__r.Amount__c, t.Transaction__r.Announce_Date__c, t.Transaction__r.Type2__c, t.Transaction__r.Target_Sector2__c,t.Transaction__r.Transaction_Headline__c from Transaction_Relationship__c t where  ( t.RecordType.Name='Buyer/Investor' or t.RecordType.Name='Seller' or t.RecordType.Name='IPO')  and (t.Transaction__r.Online__c = 'Yes') and (t.Target_ID__c =:strId or t.Related_Company_ID__c =:strId ) ORDER BY  t.Transaction__r.Announce_Date__c Desc ];
               grdData=new string[]{};               
              
               if(lstTransactionRel.size()>0)
                {   
                    integer c=0;
                    set<Id> lstIdCheck=new set<Id>(); 
                    for(Transaction_Relationship__c tr : lstTransactionRel)
                    {                  
                                string id=tr.Transaction__r.Id;
                                datetime dt=tr.Transaction__r.Announce_Date__c;
                                boolean blnCheck=false;
                                string BuyerInvestor='';
                                if(lstIdCheck.size() == 0)
                                {
                                    lstIdCheck.add(tr.Transaction__r.Id);
                                    blnCheck =true;
                                    
                                }
                                else if(!lstIdCheck.Contains(id))
                                {
                                    lstIdCheck.add(tr.Transaction__r.Id);
                                    blnCheck =true;
                                    
                                }
                                if(blnCheck)
                                {
                                       
                                        tr.Transaction__r.Transaction_Headline__c = SpecialCharHandler(tr.Transaction__r.Transaction_Headline__c);
                                                                           
                                        if( tr.Transaction__r.Target__r.Name != '' ||  tr.Transaction__r.Target__r.Name != null)
                                        tr.Transaction__r.Target__r.Name = SpecialCharHandler(tr.Transaction__r.Target__r.Name);
                                        string RltdCompany = '';
                                        string strtransId = tr.Transaction__r.Id;
                                        integer countRelCompany = 0;
                                       /* for(Transaction_Relationship__c f : [Select r.Related_Company_Id__c,r.Related_Company_Name__c from Transaction_Relationship__c r  where r.Transaction__r.Id =:strtransId and r.RecordType.Name = 'Buyer/Investor' order by r.Related_Company_Name__c asc])
                                            {
                                               string s = ((f.Related_Company_Name__c == null || f.Related_Company_Name__c =='')?'':f.Related_Company_Name__c) ;
                                               if( s != null && s != '')
                                                   {
                                                     s = SpecialCharHandler(s);
                                                     RltdCompany = RltdCompany + '<a target=\'_parent\' href=\'TransactionSearch?AccountId='+f.Related_Company_Id__c +'\'>' + s + '</a>' + ';  ';
                                                     countRelCompany = countRelCompany +1;
                                                   }
                                            }*/
                                          
                                            if(countRelCompany != 0)
                                              {
                                                RltdCompany = RltdCompany.substring(0,RltdCompany.length()-3);                      
                                              }
                                        c=c+1;
                                        string s ='';
                                        if(tr.Transaction__r.Amount__c==0.00 || tr.Transaction__r.Amount__c== NULL) 
                        {
                        
                            if(tr.Transaction__r.Profile_Link__c=='null'|| tr.Transaction__r.Profile_Link__c==null || tr.Transaction__r.Profile_Link__c=='')// to check the pdf link is empty 
                            {
                        
                                grdData.add('["' +((dt == Null)?'':dt.format('MM/dd/yyyy')) + '","' +  ((tr.Transaction__r.Type2__c == null || tr.Transaction__r.Type2__c == '')?'':tr.Transaction__r.Type2__c) + '","' +'<a target=\'_parent\' href=\'TransactionDetail?id='+ Id + '\'>' + ((tr.Transaction__r.Transaction_Headline__c == null || tr.Transaction__r.Transaction_Headline__c == '')?'':tr.Transaction__r.Transaction_Headline__c)+ '</a>'  + '","' + ((tr.Transaction__r.Target__r.Name =='null' || tr.Transaction__r.Target__r.Name==null || tr.Transaction__r.Target__r.Name=='')?'':'<a target=\'_parent\' href=\'TransactionSearch?AccountId='+ tr.Transaction__r.Target__r.Id +'\'>' + tr.Transaction__r.Target__r.Name + '</a>')+ '","' + RltdCompany + '","' + tr.Transaction__r.Target_Sector2__c+ '","' +s+ '"]'); 
                            }
                            else if(tr.Transaction__r.Profile_Link__c!='null'|| tr.Transaction__r.Profile_Link__c!=null || tr.Transaction__r.Profile_Link__c!='')// to check the pdf link is empty 
                            {
                            grdData.add('["' + ((dt == Null)?'':dt.format('MM/dd/yyyy')) + '","' + ((tr.Transaction__r.Type2__c == null || tr.Transaction__r.Type2__c == '')?'':tr.Transaction__r.Type2__c) +  '","' + '<a target=\'_parent\' href=\'TransactionDetail?id='+ Id + '\'>' + ((tr.Transaction__r.Transaction_Headline__c == null || tr.Transaction__r.Transaction_Headline__c == '')?'':tr.Transaction__r.Transaction_Headline__c)+ '</a>'+'<h5> '+  '(FT Partners profile Available) '+'</h5>'  + '","' + ((tr.Transaction__r.Target__r.Name =='null' || tr.Transaction__r.Target__r.Name==null || tr.Transaction__r.Target__r.Name=='')?'':'<a target=\'_parent\' href=\'TransactionSearch?AccountId='+ tr.Transaction__r.Target__r.Id +'\'>' + tr.Transaction__r.Target__r.Name + '</a>')+ '","' + RltdCompany + '","' + tr.Transaction__r.Target_Sector2__c+ '","' +s+ '"]'); 
                            }
                        }
                        else
                        {
                        if(tr.Transaction__r.Profile_Link__c=='null'|| tr.Transaction__r.Profile_Link__c==null || tr.Transaction__r.Profile_Link__c=='')// to check the pdf link is empty 
                            {
                                grdData.add('["' + ((dt == Null)?'':dt.format('MM/dd/yyyy'))  +  '","' + ((tr.Transaction__r.Type2__c == null || tr.Transaction__r.Type2__c == '')?'':tr.Transaction__r.Type2__c) + '","'  + '<a target=\'_parent\' href=\'TransactionDetail?id='+ Id + '\'>'+ ((tr.Transaction__r.Transaction_Headline__c == null || tr.Transaction__r.Transaction_Headline__c == '')?'':tr.Transaction__r.Transaction_Headline__c)+ '</a>'+  '","' + ((tr.Transaction__r.Target__r.Name =='null' || tr.Transaction__r.Target__r.Name==null || tr.Transaction__r.Target__r.Name=='')?'':'<a target=\'_parent\' href=\'TransactionSearch?AccountId='+ tr.Transaction__r.Target__r.Id +'\'>' + tr.Transaction__r.Target__r.Name + '</a>')+ '","' + RltdCompany + '","' + tr.Transaction__r.Target_Sector2__c+ '","' +tr.Transaction__r.Amount__c+ '"]'); 
                             }
                             else if(tr.Transaction__r.Profile_Link__c!='null'|| tr.Transaction__r.Profile_Link__c!=null || tr.Transaction__r.Profile_Link__c!='')// to check the pdf link is empty 
                            {
                                grdData.add('["' +   ((dt == Null)?'':dt.format('MM/dd/yyyy'))  + '","' + ((tr.Transaction__r.Type2__c == null || tr.Transaction__r.Type2__c == '')?'':tr.Transaction__r.Type2__c) + '","' +'<a target=\'_parent\' href=\'TransactionDetail?id='+ Id + '\'>'+ ((tr.Transaction__r.Transaction_Headline__c == null || tr.Transaction__r.Transaction_Headline__c == '')?'':tr.Transaction__r.Transaction_Headline__c)+ '</a>'+ '<h5> '+ '(FT Partners profile Available)'+'</h5>' +  '","' + ((tr.Transaction__r.Target__r.Name =='null' || tr.Transaction__r.Target__r.Name==null || tr.Transaction__r.Target__r.Name=='')?'':'<a target=\'_parent\' href=\'TransactionSearch?AccountId='+ tr.Transaction__r.Target__r.Id +'\'>' + tr.Transaction__r.Target__r.Name + '</a>')+ '","' + RltdCompany + '","' + tr.Transaction__r.Target_Sector2__c+ '","' +tr.Transaction__r.Amount__c+ '"]'); 
                            }
                        }
                                }                           
                     }
                     count=c;
               }
              
               if(grdData.size() == 0)
               {
                   grdData.add('["","","","No Related Transactions Found","","","",""]'); 
               }
          }    
        }
        catch(Exception ex)
        {
            ApexPages.addMessages(ex);
            system.debug('Company Buyer catch$______________$'+ ex);
        }
   }        
}

 Regards,

kathir

Kathir DevanKathir Devan

Hi Digamber,

 

I send my controller code,what do i change in my controller,am trying to do last 3 days but am getting same err,how to resolve this please help me.

 

Regards,

kathir

digamber.prasaddigamber.prasad

Hi, 

 

Its not just about controller, seems like you have huge number of records in your database too. Please confirm!

Kathir DevanKathir Devan

Hi,

 

Thanku for your reply. Could you give me any suggestion to resolve this err but some records is display some record is not display why this happen.

 

Regards,

kathir

 

digamber.prasaddigamber.prasad

Hi,

 

Could you please try this on one of your dev org or dev sandbox? And let me know how it goes?