Subject: RE: Help with an agent
You might be making this more complicated than it needs to be. You could write this in macro language.
emps := @DbColumn(“”; “”; “Employees”; colNo);
emps7Day := @DbColumn(“”; “”; “SAT Last Weeks Time”; anotherColNo);
recipients := @trim(@Replace(emps; emps7day; “”));
@MailSend(“”; “”; recipients; “Please enter your timesheet!”; “Our records show that you are overdue to enter a timesheet.”…)
Of course this depends on having an expensive view that shows only the most recent week’s timesheets. There are ways of doing this that avoid using @Today, which have been discussed here so extensively that I’ll just let you search.
But to do it without such a view, you might find it easiest to use a list in LS.
Dim employeeTrack List As Integer
’ skim down the view of employees…
…
employeeTrack(doc.GetItemValue(“Name”)(0)) = 0
…
’ scan the view of timesheets categorized by employee and sorted by most recent first…
use a NotesViewNavigator, read the category heading, then fetch the next document row, look at the date, see whether it’s too old, if it’s recent enough do:
if iselement(employeeTrack(employeename)) then erase employeeTrack(employeename)
finally, loop thru the remaining list elements and send an email to each slacker:
Forall x in employeeTrack
employeeName = listtag(x)
’ send mail to employeename
End Forall