1
How to pop up a dialog if a record in a table meets a criteria.
I have a table with three records each with a specific date in a field called next date. I am trying to use the trigger after open function to allow a dialog to pop up when the date in the next date field of any record is today. At the moment the dialog is popping up regardless of the date. How do I fix this?
here's my code:
let z := (select 'Reminders' where 'Next Date' = today());
let i := join(z.Reminder, "
");
if z !=null then
let result := dialog("A reminder is due today. Do you want an email detailing what needs to be done?", i, ["Yes", "No"]);
if result = "Yes" then
alert("You pressed Yes and an email will be sent");
sendEmail({
from: "m",
to: ".com",
cc: "",
subject: "Test lab reminder",
text: "This is a test reminder."
})
else
if result = "No" then
alert("You pressed no and an email will not be sent")
end
end
else
alert("Space")
end
7 replies
-
Change the first 4 lines code in and see if this works:
if cnt(select Reminders where 'Next Date' = today()) > 0 then
-
That should work, but when I add count it tells me I have an error on lines 2 and 3.
-
Now however, i is not defined.
-
Try this
let z := (select 'Reminders' where 'Next Date' = today()); if cnt(z) > 0 then let i := join(z.Reminder, " "); let result := dialog("A reminder is due today. Do you want an email detailing what needs to be done?", i, ["Yes", "No"]); if result = "Yes" then alert("You pressed Yes and an email will be sent"); sendEmail({ from: "m", to: ".com", cc: "", subject: "Test lab reminder", text: "This is a test reminder." }) else alert("You pressed no and an email will not be sent") end else alert("Space") end
Content aside
-
1
Likes
- 1 yr agoLast active
- 7Replies
- 159Views
-
5
Following