Modify Records

 

Description

In the previous topic, Fetch Records we learnt how to retrieve the form data and store it in a form variable. This form variable, also called collection variable, contains the retrieved form data. You can now modify the retrieved data by accessing the required field values through the form variable.

Syntax

<formvariable>.fieldname = <expression>

where,

  • formvariable - it is the name of the collection variable that contains form data. Read More

  • fieldname - name of the field to be updated

  • expression - any valid deluge expression that evalutes to a value

If you are updating the value of the current form record being submitted, you need not explicitely fetch them. You can directly use the fieldname for updating as given below:

fieldname = <expression>

where,

  • fieldname - name of the field to be updated

  • expression - any valid deluge expression that evalutes to a value

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 and update the value. Here, we have updated the Status field with value as "Issued".

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