Forms are structures that contain data in Zoho Creator. The form data is stored in a relational database and Deluge provides an easy wrapper called collection variable for accessing these data. The collection variables hold one or more records fetched from a form, based on a given criteria, sort by and range. To access the currently submitted/persisted field values, you can use the Deluge variable named input with syntax input.<fieldname>
<collection variable> = formname[<criteria>] sort by <field> range from <x> to <y>;
collection variable - name of the variable that contains the fetched records from the form.
formname - name of the form whose data has to be fetched.
criteria expression - the criteria expression that evaluates to a value
sort by <field> - the field based on which the records will be sorted in ascending order . By default, the records will be sorted in ascending order. Specifying the sort by <field> is optional.
sort by <field> desc - the field based on which the records will be sorted in descending order.
range from <x> to <y> - range enables you to limit the records fetched 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 fetched.
In the following example, the on add -> on success script is written to fetch specific records from the Book form with Name same as the currently submitted book name in the "Issue Book" form. The record fetched is stored in the collection variable named myBook. You can now access any field in this record, from the myBook collection variable.
if (count(Book [ID == input.book]) > 0)
//fetch the book row from the 'Book' form
myBook = Book [ID == input.book];
//modify the 'Status' of this book to 'Issued'.
myBook.Status = "Issued";