You need to sign in to do that
Don't have an account?
Ap30
Count of records processed in batch class
Hi All,
In my below code i have to get the count of 'unchecked' records whenever apex is executed in batch class. Please guide me how to get the count for only 'unchecked' records found.
if(t.Profile__c == null)
{
t.Status__c = 'Fill data';
}
else if(t.Profile__c != null && t.Check__c == 'No')
{
t.Verification_Status__c = 'Unchecked';
}
In my below code i have to get the count of 'unchecked' records whenever apex is executed in batch class. Please guide me how to get the count for only 'unchecked' records found.
if(t.Profile__c == null)
{
t.Status__c = 'Fill data';
}
else if(t.Profile__c != null && t.Check__c == 'No')
{
t.Verification_Status__c = 'Unchecked';
}
If you want to get the count of 'unchecked' records. You can take the reference from this below code. Maybe this code will help you. In case you find any other issue please mention.
If you find your Solution then mark this as the best answer.
All Answers
If you want to get the count of 'unchecked' records. You can take the reference from this below code. Maybe this code will help you. In case you find any other issue please mention.
If you find your Solution then mark this as the best answer.
Try Below Code Please Mark It As Best Answer If It Helps
Thank You!
To maintain count of records processed across transaction in batch Apex you have to use stateful batch apex i.e implements Database.Stateful.Please find below reference
When to use stateful:
https://salesforce.stackexchange.com/questions/175355/database-stateful-when-to-use-it/175371
Sample code with counter
https://salesforce.stackexchange.com/questions/123880/put-a-counter-in-batch-apex-class
Please mark this answer as best if it helps so that others facing same issue will find it useful.
Thanks!