I think my query was mis-understood. My problem is not related to calculating the overdue days. Its very well calculated. My problem is - rather than sending separate emails for each item, wanted one single consolidated mail.