Trying to fire an email that contains a group of reports for a single country

Trying to fire an email that contains a group of reports for a single country

I'm trying to fire an email that contains a group of reports for a country. For instance reports due for this month or reports past due, etc.

I've got it sending 1 report per email - not what I want
and
I've got it sending all reports to every country (not just their own, but every single one) - not what I want

What I want is to send only the reports for a particular country in a single email. As in sending the 4 over due reports for Ghana in one email.

Thoughts?


********************
This sends every report in a separate email - not what I want

  1. temp = "";
  2. for each x in RSCS_Main[((Received == false && Ignore == false) && Due_Date < zoho.currentdate)]
  3. {
  4.     temp = temp +  x.Training_Location + " - " + x.Report_Type.Report_Name + "<br><strong>Due Date: </strong>" + x.Report_Date + "<br><br>";
  5. }
sendmail....

*********************
This sends all reports to all countries - not what I want

  1. temp = "";
  2. for each x in RSCS_Main[(Country is not null)]
  3. {
  4.     for each y in RSCS_Main[((Received == false && Ignore == false) && Due_Date < zoho.currentdate)]   // * Referring to over-due reports
  5.     {
  6.        temp = temp +  y.Training_Location  + " - " +  y.Report_Type.Report_Name + "<br><strong>Due Date: </strong>" + y.Report_Date + "<br><br>";
  7.     }
  8. }
sendmail....

********************
I tried the below, but it wouldn't let me use the "x" variable in the 2nd for each statement:

  1. temp = "";
  2. for each x in RSCS_Main[(Country is not null)]
  3. {
  4.     for each y in [((Received == false && Ignore == false) && Due_Date < zoho.currentdate)]   // * Referring to over-due reports
  5.     {
  6.        temp = temp +  y.Training_Location  + " - " +  y.Report_Type.Report_Name + "<br><strong>Due Date: </strong>" + y.Report_Date + "<br><br>";
  7.     }
  8. }
  9. sendmail....