The "Task Management" application illustrates the usage of for each record Deluge statement, to iterate records in a form. The applicationcomprises of the following forms:
Staff Details: To store the staff details like name, emailid etc.
Task: To store the task details like task name and description.
Assign Task: To assign one or more task to a staff member.
In the "Task Management" application, we want to send emails individually to each staff belonging to a specific module, say "Scripting". To do this we have to add on success script in the Staff Details form. The script will iterate through each staff record in the Staff Details form who belong to a specific module and send mail to their email id with the specified message.
Code Explanation
1. Iterates through each record in the Staff Details form whose module name is "Scripting". r is the name of the variable that will hold the data corresponding to each iteration.
for each r in Staff_Details [Module == "Scripting"]2. The sendmail function is called to send an email to the Emailid of the staff. Here, r.Email_Id, will fetch the email id from the variable r which holds each iteration of a record.
Refer the topic, Iterate Data in radio buttons/check-boxes, to iterate multiple list values within each record.