Get Field Count using Aggregate Function:
List<AggregateResult> ui=[Select count(loan__Rejection_Reason__c) cnt,count(loan__Reversal_Reason__c) cnt1,count(Failure_Reason__c) cnt2,loan__Loan_Account__c from loan__Loan_Payment_Transaction__c where loan__Rejection_Reason__c !=null group by loan__Loan_Account__c];
for(AggregateResult ar: ui)
{
//loan__Loan_Payment_Transaction__c lt = new loan__Loan_Payment_Transaction__c();
String str = '' + ar.get('loan__Loan_Account__c') ; //Get profileId
String str1 = '' + ar.get('cnt') ;
String str2 = '' + ar.get('cnt1') ;
String str3 = '' + ar.get('cnt2') ;//Get count of Id using the alias name
System.debug('##########'+str);
System.debug('$$$$$$$$$$$'+str1);
System.debug('%%%%%%%%%%'+str2);
System.debug('&&&&&&&&&&'+str3);
}
No comments:
Post a Comment