You need to sign in to do that
Don't have an account?
Abi V 4
Compare Current Month with Integer field inside For loop
String currentmonth = String.Valueof(Date.Today().Month());
for(test__c revn :revnlist){
if(revn.invoice_month__c.equals(currentmonth)){
revenuelist.add(revn);
}
}
It is not entering into If condition.Here the invoice_month__cholds the values like 1,2,3.. and currentmonth values like 1,2,3..etc
for(test__c revn :revnlist){
if(revn.invoice_month__c.equals(currentmonth)){
revenuelist.add(revn);
}
}
It is not entering into If condition.Here the invoice_month__cholds the values like 1,2,3.. and currentmonth values like 1,2,3..etc
Replace Account acc with revnlist
String currentmonth = String.Valueof(Date.Today().Month());
system.debug('***'+currentmonth);
List<Account> acc = [Select Id, Name, Site, NumberOfEmployees from Account]; // query record for the revnlist object
for(Account revn : acc){
if(revn.Site == currentmonth){
system.debug('***Site'+revn.Site);
// revenuelist.add(revn); create a new list and add value into that list
}
else{
system.debug('***currentmonth'+currentmonth);
}
}
Let me know if this helps you.
List<test__c> revenuelist= new List<test__c>();
set<String> revsetmonths=new set<String>();
List<test__c> revenuelistquery=[select master_customer_nbr__c,master_customer_name__c,customer_po_nbr__c,order_nbr__c,quick_look_id__c,invoice_quater__c,invoice_month__c from test__c where quick_look_id__c IN:qlkid];
String currentmonth = String.Valueof(Date.Today().Month());
for(test__c revn:revenuelistquery){
if(selectedreports =='Revenue YTD'){
revenuelist.add(revn);
}
if(selectedreports =='Revenue MTD') {
system.debug('entermtdif###1');
if(revn.invoice_month__c == currentmonth){
system.debug('entermtdif###2');//not enetring into this loop
revenuelist.add(revn);
}
}
}
qlkid is user object text fielsd and selectedreports is selectlist value from Vf page