How to Iterate Records in a Form

How to Iterate Records in a Form

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. 

Adding Deluge Script 

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. 

To install the application,

  1. Download the script file (.ds file)
  2. Install the application to your account. Click here to learn how to install using the script file (.ds file)
    • Related Articles

    • How to Iterate Records in a Form

      About the application  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, ...
    • How can I iterate a collection of records?

      The for each syntax in Deluge scripting, enables you to conditionally fetch a collection of records and iterate over them. Let us illustrate this with the help of a simple example. The CEO of a company wants to address all the new employees who have ...
    • How can I fetch all the records in a form?

      To fetch all the records in a form, specify the criteria as [ID != 0], where ID is a auto-generated field that contains a unique value for each record in the form. Example:  rec = Contact [ID != 0] sort by Added_Time range from 1 to 5; where, rec it ...
    • How to find and remove duplicate records in my Form

      It is possible to find the duplicate entries in the database and delete them. Below is the example of removing duplicate email entries in your database. You can replace the Email field with the field name that you want to find for duplicate entries. ...
    • If I delete a record in a form (table) that has "child" records in another form, the child records are not deleted. How can I delete the child records?

      bout the application The application Deleting child nodes illustrates how to delete child records when a record is deleted from the parent form.The applicationcomprises of two forms: Client form to enter the client name (master form). Client ...