About the application
You can fetch and update records from a form using Deluge script. Let us illustrate this with the help of an example. The application Library Manager has two forms:
Books - To enter the details about each book with fields Name, Status and Author. The following books are owned by the library. The column 'Status' with values 'Available' and 'Issued', indicates whether the book is available in the library or is issued to any user.
Issue Book - To enter the details about the books issued. This form has a lookup field "Book Name" which imports the Books from the above form. Only the Books whose status is "Available" is listed in the lookup field. This is achieved by specifying the criteria Status=="Achieved", while creating the lookup field. When a Book is issued, the status of the Book is updated from "Available" to "Issued" in the Books form. For example, the following books are issued.
In the Books form, the Status of these books will be set to "Issued". This is achieved using the "Issue _Book -> on add -> on success" script, given below:
Code Explanation
MyBook = Books [Name == input.Book_Name]; - Fetch records from Books form with the given criteria and store it in collection variable named "MyBook"
MyBook.Status = "Issued"; - Access the Mybook variable and update the Status field with value "Issued".
The books issued is now updated with Status as "Issued" in the Books form, as shown in the screen-shot below: