Creator Fetch and Email Forms Help

Creator Fetch and Email Forms Help

I am trying to understand this support article:

https://www.zoho.com/creator/help/script/fetch-and-email.html

I want to add a script on Success to fetch the records with the same email as indicated in the form (as a summary of form activity) and then put the records into the body of a sendmail.

The article has this: (excerpted to show the part I'm focused on)

...
 for each r in Subscription_Form [isUnsubscribed == false]
 {
 sendmail
 (
 To : r.EmailId 




...

Code Explanation

...
  • for each r in Subscription_Form [isUnsubscribed == false] – Here, isUnsubscribed is a Decision Check field and r is a variable that stores the records whose isUnsubscribed status is false.
But it does not explain how to declare the r variable so that it is storing the necessary records.

Sorry I am new to scripting and I barely understand HTML. This is what I have tried so far:

myemail = input.Email;
myreport  =  Tracking_Form  [Email == myemail];
for each r in myreport
{
//I don't know what to put here
}
sendmail
(
    To       :  myemail
    From     :  zoho.adminuserid 
    Subject  :  "Summary of Form Activity" 
    Message  :  "Hello&nbsp;" + input.First_Name + "<br>Please see the following summary of your Form Activity.<br>" + myreport + "<br>If you have any questions or you find any errors, please contact our administrator immediately." 
)
success message "Form submitted successfully";

 but I don't know what to do with the for function or what to put in the body of the message. myreport currently returns  Tracking_Form[ ID in (1897236000000042019, 1897236000000042027,1897236000000042031,1897236000000049003,1897236000000051003) ]

Thank you for your help!