Try Microsoft Edge
A fast and secure browser that's designed for Windows 10
I need to send mail based on customer due date if one customer having multiple line with same due date i need send a mail only 1 time but unfortunately its sending multiple time if 2 record with same duedate its sending mail for two time i dont want to send two time,please tell me how to put the filter for that.
Can you please show us the code that you wrote?
IF customerLedgerTable.FINDSET THEN REPEAT
DueDate := customerLedgerTable.DueDate;
// it will check the duedate equal to today date if true means it will send the mail
if Duedate = TODAY THEN //here only i need to stop multiple time mail send for 1 customer same duedate
You can create a boolean variable say Check in customer ledger entry if mail sent then enable the boolean variable.
If (Duedate = TODAY) AND (Check =FALSE) then
You need to create variable say TempDateof type Date and write the following code.
IF CustomerLedgerEntries.FINDFIRST THEN
IF TempDate<>CustomerLedgerEntries.DueDate THEN BEGIN
TempDate = CustomerLedgerEntries.DueDate;
What you need is Loop through the customer table as main loop and inside the customer table loop check the customer ledger entries for that customer with Due Date greater then today and if you find a record then send the email, this way you will not send duplicate emails and you don't need any additional field or logic.
I believe you skipped one Important point. You want to send one email based on due date which is if repeating then it should send only one but for that respective customer right? If there are 4 same due date but have 2 different customers then there would be 2 email for that 2 Customers.
Try to do as Suresh Suggested and if still failed then let us know.