Zoho Creator : Modify data across forms

In our latest update, we have just made zohocreator more powerful. We have empowered deluge scripting with the ability to modify existing data using our new ‘Update field task’. We already supported fetching of existing form data and now you can fetch and update the values.

Lets us see a library managerin action for illustration

Take a very simple use case : User is borrowing a book from the library

In library manager terminology, it is called ‘Issuing a Book’.

1). 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.

2).Already the following books were issued to the users on the mentioned issue date.

(Note:This view is created from the form ‘Issue Book’ shown below this view.)


3).Now, we are getting a scenario where the user ‘James’ is borrowing the book ‘The City of Joy’.

Use the ‘issue book’ form given below to get book name and user name.

(Note: The above view ‘Books Issued Details’ represent the data in this form. Also in this form, the field ‘Issue date’ is hidden and not shown to the user for filling.)

In addition to getting book and user information, we need to do the following

  • Store the current date in the ‘issue date’ field(hidden from user) of the above form, indicating that the book is issued today.
  • Change the status of this book from ‘Available’ to ‘Issued’.(This data is available in different form i.e Book form)

As you can see, these two operations need not be done explicitly by the user as they can be automatically calculated.
This is where our ‘Update field task’ comes into play.

Especially in the second operation, we have to get the corresponding book (i,e. The City of Joy) from the book form data and modify it.

We can use the ‘on success‘ event block of the ‘Issue Book’ form to write the three lines of code , that is going to do the magic.

on success
{

//store the current time in ‘issue date’ field.
issuedate = zoho.currenttime;

//fetch the book row from the ‘Book’ form
myBook = Book [Name == input.book];

//modify the ‘Status’ of this book to ‘Issued’.
myBook.Status = “Issued”;

}

Below , you can see the changes done after submitting the form.

  • ‘Status’ of the book ‘The City of Joy’ is modified.
  • Current date is automatcally stored in the ‘Issue date’ field (See the new entry added at the top).

Thus you can see that your applications created in zohocreator can just get the minimally required information from the user and modify any other related parameters anywhere in the application using the ‘Update field task’. It helps in incorporating a lot of intelligence into your application, moving away the unnecessary burdens from the end user.Your application can no more be a mere store and retrieval place. It can be more lively now.

You can have a glimpse of my library manager completely created from scratch using our zohocreator.

Comments

Leave a Reply

Your email address will not be published.

The comment language code.
By submitting this form, you agree to the processing of personal data according to our Privacy Policy.

Related Posts