You need to sign in to do that
Don't have an account?
Frank Carter
apex method for wrapper class to improve
Hello,
I neeed help.
I created a vf page that show records. I have a method which puts the month of a date field of each record selected to the current month. I have noticed, however, that by selecting more than 40 records, the page gives an error on line 39 (update selectedBD). it takes a long time to process.
I maybe implement logic the wrong way? there is better way?
Can Someone help me?
Thanks
I neeed help.
I created a vf page that show records. I have a method which puts the month of a date field of each record selected to the current month. I have noticed, however, that by selecting more than 40 records, the page gives an error on line 39 (update selectedBD). it takes a long time to process.
public class SearchWithWrapperC { public Date StartDate {get;set;} public Date EndDate {get;set;} public List<WrapperClass> listBD {get;set;} public void loadData() { listBD = new List<WrapperClass>(); for(Billing_Detail__c cr : [Select Id,SF_Opportunity_Id__c,Account_Name__c,Billing_Detail__c, Name,Billing_Type__c, Billing_Period__c , Monthly_Forecast__c,End_of_Billing__c, Amount__c, Billing_Status__c from Billing_Detail__c Where Billing_Status__c='Authorized for Billing'AND Monthly_Forecast__c>=:StartDate AND Monthly_Forecast__c <= :EndDate Order by Account_Name__c, Monthly_Forecast__c]){ listBD.add(new WrapperClass (cr, false)); } } public List<WrapperClass> getBilling() { if(listBD == null) { listBD = new List<WrapperClass>(); for(Billing_Detail__c cr : [Select Id,SF_Opportunity_Id__c,Account_Name__c,Billing_Detail__c, Name,Billing_Type__c, Billing_Period__c , Monthly_Forecast__c,End_of_Billing__c, Amount__c, Billing_Status__c from Billing_Detail__c Where Billing_Status__c='Authorized for Billing'AND Monthly_Forecast__c>=:StartDate AND Monthly_Forecast__c <= :EndDate Order by Monthly_Forecast__c ]){ listBD.add(new WrapperClass (cr, false)); } } return listBD; } public PageReference processSelected() { Integer m = Date.Today().Month(); List<Billing_Detail__c> selectedBD = new List<Billing_Detail__c>(); for(WrapperClass bd: getBilling()){ if(bd.check_box== true){ selectedBD.add(bd.cs); } } for(Billing_Detail__c cs: selectedBD) { cs.Monthly_Forecast__c = Date.newinstance( cs.Monthly_Forecast__c.year() , m , cs.Monthly_Forecast__c.day() ); update selectedBD; System.debug('The value is: ' + cs.Monthly_Forecast__c ); } return null; } public class WrapperClass { public Billing_Detail__c cs {get; set;} public Boolean check_box {get; set;} public WrapperClass(Billing_Detail__c c, Boolean check_box){ this.cs = c; this.check_box = false; } } }
I maybe implement logic the wrong way? there is better way?
Can Someone help me?
Thanks
I have updated Above Code I think it works for you :
All Answers
I have updated Above Code I think it works for you :
When the users click the Moves o the next buton the results doesn't update. I tried addding rerender with id Pagination but nothing.
Can you help me, please?
thanks