Unlike other languages which supports iteration based on numerical values, say iterate 10 times, deluge supports only data driven iterators that are purely based on form data. You can iterate through all the rows in the form or through selected rows based on the given criteria.
Row-variable - This variable will hold the data for a single row corresponding to each iteration.
Formname - Name of the form whose data has to be iterated one by one.
Criteria - In most of the cases, you would like to conditionaly fetch the data. You can specify your criteria for fetching the form data here. It is an optional parameter.
sort by <field> allows you to sort the iterated records based on the specified <field>. It is an optional parameter.
range from <x> to <y> enables you to limit the records iterated within the start index (x) and end index (y). If range is not specified, all the records in the form that satisfy the given criteria, will be iterated in an ascending order. To iterate the records in descending order, replace range from <x> to <y> with desc.
The Task Management application illustrates the usage of for each deluge task to iterate records in a form. The application consist of 3 forms.
In the Task management application, the task is to send mail to each staff belonging to a specific module say "Scripting". To perform this action, we have to add the deluge script to WorkFlow --> On Add --> On Success section of the Staff Details form. The sample script mentioned below will iterate through each staff record in the Staff Details form who belong to a Scripting module and send mail to their email id with the specified message.
The code mentioned above iterates through each record in the Staff Details form whose module name is “Scripting” where,
r is the name of the variable that will hold the data (Staff Name) corresponding to each iteration.
The sendmail function mentioned above is used to send an email to the staff Email Id. Here, r.Email_Id, will fetch the email id from the variable r which holds each iteration of a record.
To install the application,