You need to sign in to do that
Don't have an account?
Updating a batch job only after the last batch has been processed.
Is it possible to only update after the very last batch has been proccessed in a batch apex job? I'm using a stateful batch to determine the mean, UCL, and LCL of a large dataset. What I was hoping to do was have this job run every night, and by tracking the field history be able to report/graph on the moving average of these values.
My first thought was to assign Database.countQuery / [batchsize] to a variable allowing me to check if i was on the last batch within the execute method. Unfortantly, it doesn't appear that this is allowed.
Any suggestions would be greatly appreciated.
Dave
You can query the current batch job and get the no.of batches. As you are using the stateful batch you can find out which one is the last job and then update the last record.