I have a form with a date field “Fdbckdue” and a textfield “DteFdbckSub”.
Now it’s the intention to send an Email to a person, every 5 days (starting when the date in field Fdbckdue is completed) as long as the DteFdbckSub = spaces.
Therefor, I created an agent (which runs at a daily basis) with these instructions in Formula.
Emailbody:=“blabla”;
temp1 := (@Today-Fdbckdue)/86400;
@If((temp1 = 5 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60)& DteFdbckSub = “” ;
@Do(
@MailSend(“person”;“”;“”;“blabla” + seqnr;Emailbody;“”;[IncludeDoclink]);
@Command([FileSave]);
@Command([FileCloseWindow])
);“”);
SELECT @All
The problem is now that people are getting this email every day.
Any idea?
Subject: Problem with triggering on date
Try this:
Emailbody := “blabla”;
@If(DateDue = @Today & DteFdbkSub = “”;
@Do(
@MailSend("person";"";"";"blabla" + seqnr; Emailbody;"";[IncludeDoclink]);
FIELD Fdbckdue := @Adjust(Fdbckdue;0;0;5;0;0;0)
);
""
);
SELECT @All
It checks the value in Fdbckdue to see if it’s today’s date, if it is then it sends the mail and then overwrites the value in Fdbckdue with Fdbckdue + 5 days.
Hope this helps.
Subject: Problem with triggering on date
To both of you,Many thanks for your help. I’m out of problems now.
Herwin
Subject: Problem with triggering on date
You need to use : not | to seperate your values when testing temp1.
You are testing whether temp1 is 5 and then | 10 returns @true which is why it runs every day.
Another way of writing it is
@If(temp1 >= 5 & temp1 <= 60 & (@Modulo(temp1; 5) = 0) & DteFdbckSub = “”;
Also why are you using @Command([FileSave]) and @Command([FileCloseWindow]) in a scheduled agent?