Calendar Reminders based on condition

I’ve read other posts about this but no solution has been offered so here’s a new post.

I’m having trouble trying to create emailed reminders for the calendar application.

Logic:


if 
(record exists where {start_date} is equal to todays date and record was created by [global_employee_variable])
{
 send an email with sc_mail_send
}
else
{
  do nothing
}

I want to be able to fire off an email to a user when they run the calendar app only if they have an event scheduled and it is the current day.

CURDATE() works in SC SQL defenitions but doesn’t seem to be working in php macros, probably because my syntax is wrong.

I can send emails with the sc_mail_send macro like there’s no tomorrow but getting the sc_lookup or sc_sql_select macros to work is a different story.

I don’t understand why I need a dataset. I kind of understand how it works, row/column and how to access the data, but I don’t know what I’m supposed to put in the array.

To make a long story short: Calendar reminder that sends emails only if YOU have something scheduled TODAY!

This is what I have so far.


/**
 * Selecting a field from another table
 */

// Check for record
$check_sql = "SELECT id, description, title"
   . " FROM calendar"
   . " WHERE start_date = '" . CURDATE() . "' AND emp_id = '" . [usr_emp_id] . "'";
sc_lookup(rs, $check_sql);

if (isset({rs[0][0]}))     // Row found
{
   {???} = {rs[0][0]};
   {???} = {rs[0][1]};
}
  else     // No row found
{
   {???} = '';
   {???} = '';
}