Fetch Records
Description
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>
.
Syntax
<collection var> = formname[<criteria>] sort by <field> range from <x> to <y>;
|
where,
-
formvariable - it is the name of the collection
variable that contains form data.
-
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. Specifying the sort by <field> is optional.
- 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.
Example
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. The record fetched is stored
in the collection variable named myBook. You can now access any
field in this record, from the myBook variable.
on success
{
//fetch the book row from the 'Book' form
myBook = Book [Name == input.book];
//modify the 'Status' of this book to 'Issued'.
myBook.Status = "Issued";
}
|
Related Links
Tips & Tricks -> Fetch
and Update Records
|