Hello beautiful people. Have a rookie question that has me banging my head against the wall. Trying to loop a mail send using formula language and not getting it to work. Here’s the situation:
I have to send reminder emails to supervisors whose employees haven’t filed time sheets for the last pay period; one email to each supervisor with a list of the employees. I already have a handle on StartingDate, which is a text value. Here’s my code:
{This gets me a list of the supervisors who have employees who haven’t filed a time sheet. This works perfectly.}
sups:=@Unique(@DbLookup(“”; “”; “LUPinkSheetStatus”; StartingDate; 2));
{This gets me a list of the employees who haven’t filed a time sheet, but returns ALL employees, not one for each supervisor:}
emps:=@Unique(@DbLookup(“”; “”; “LUPinkSheetStatus2”; StartingDate+sups; 2));
{Finally, this is the code that I was hoping would send an email to each supervisor with a list of just that supervisor’s employees, but doesn’t do a thing:}
Total:=@elements(sups);
@For(Counter:=1;
Counter<=Total;
Counter:=Counter+1;
emailaddr:=sups[i];
@MailSend(emailaddr;“”;“”;“Employees who haven’t filed a time sheet for the period starting on “+StartingDate;””;@Implode(emps;@newline))
I’m thinking the employee list needs to be in a loop, too, but I can’t get far. Any advice would be very much appreciated!