ITECHLEADZ

How does Zoho Creator Deluge add a new row to a subform?

To add a row in a subform of Zoho Creator with Deluge, set up row variables connected to the subform. Then give values to the fields, and then add this row to a collection using an input. Insert () syntax to include it in the form. This method is only available when custom sorting isn’t included on the form.

Zoho Creator is a powerful software that lets you create custom business applications quickly. One of the most impressive features is its ability to utilize subforms that allow you to save multiple similar records within an overall form. There are times when you have to add rows to the subforms promptly. This is when Deluge, Zoho’s scripting language, is extremely useful. 

In this blog, we’ll guide you through using Deluge for adding a brand new row on a subform step-by-step.

Understanding Subforms in Zoho Creator

Subforms function as an incredibly small table within the larger form. For example, if you are using a form to process orders from customers, a subform will be able to hold the items that are included in every purchase. Every row of the form is an individual product and includes details such as the names, quantities, and cost. Subforms help keep related information well-organized and simple to handle.

What is Deluge, and why use it?

Deluge is Zoho’s scripting language. It assists in automating tasks and altering how the Zoho Creator app works. Through Deluge, it is possible to add, update, or remove rows from a subform with no need to do manual work. This can be useful when you need to make data entry easier or change subform data by relying on the actions of the application.

Key Entities and Attributes for Adding Rows

For adding a new row in a subform with Deluge, you must be aware of the following terminology:

  • Main Form Link Name: This is the name of the primary form, which holds the subform.
  • Subform Link Name: The title you want to use for the subform to which you would like to include rows.
  • The row variable is a variable that corresponds to a single row of the subform.
  • Field Link Name: The title given to every field (column) on the form.
  • Value: The information that you would like to include in each of the fields.
  • Collector Variable: A field that contains several rows before placing them in the subform.

Step-by-Step Guide to Adding a New Row to a Subform

Basic Deluge Syntax for Subform Rows

Here’s the procedure for adding a new row to an existing subform within Zoho Creator by using Deluge:

1. Create a Row Variable

The variable represents the new row you’d like to include.

text

row1 = <mainForm_linkName>.<subForm_linkName>();

2. Assign Values to the Row Fields

Set the values for each field in the row.

 text

row1.<field_linkName1> = <value1>;

row1.<field_linkName2> = <value2>;

3. Create a Collection and Insert the Row

Collections are used to hold rows before adding them to the subform.

 text

rows = Collection();

rows.insert(row1);

4. Insert the Collection into the Subform

 This final step adds the new row to the subform.

 text

input.<subForm_linkName>.insert(rows);

This method is not supported for subforms with custom sorting enabled.

Preventing Overwriting of Existing Rows

In addition to adding rows, it is important to avoid the deletion of any existing information in the subform. It is best to:

  • Retrieve all rows currently in the subform.
  • Include the new row(s) in your existing collection.
  • Re-insert the collection in the subform.

The old entries are protected and will only update to the new entries.

Assigning Values to Subform Fields

Each of the fields in your form (like “Product Name,” “Quantity,” or “Price”) is required to be given a number. Make use of the field’s link name within your script. Examples:

text

row1.Product_Name = “Notebook”;

row1.Quantity = 3;

row1.Price = 10.5;

You can add any number of fields you want to your form; however, be sure that the names of your fields coincide exactly.

Automation of Workflows using Subforms

Zoho Creator lets you initiate workflows each time a new row appears on an existing subform. It allows you to automate the aviation workflow follow-up steps, such as making notifications or even making other records, when a new row is added. For setting this up:

  • Navigate to the settings for your workflow.
  • Select the “Addition of row” option within the “When to trigger workflow” dropdown.
  • You can define the actions you wish to occur after the new row is created.

The app will become more efficient and will save you time.

Common Use Cases

The addition of new rows to subforms can be beneficial in many scenarios, for example:

  • The recording of multiple items on the sales order.
  • The process of tracking tasks is part of a project application for managing projects.
  • The process of recording expenses associated with an upcoming business trip.
  • The management of student grades is a key feature in an app that helps students with their grades.

This option makes data entry easier using other forms and other sources.

Tips for Error-Free Implementation

  • Make sure to check field names. Use fields with the proper links.
  • Beware of Custom Sorting Insert task will not work on subforms that include custom sorting.
  • Always utilize the collection variable to keep the new rows before inserting.
  • Make sure to test your script: Use your script by using tests to ensure that it functions as you expect.
  • Before making changes to subforms, ensure you’ve got a backup of your information on the subforms, particularly if data is critical.

Conclusion!

Making new rows in an existing subform within Zoho Creator using Deluge is a straightforward yet effective way to manage and streamline your information. Follow the instructions above, and you will be able to keep your records in order and let your app function more efficiently for users. 

Do you want to improve the efficiency of your data entry process? Make contact with Itechleadz now for assistance using Zoho Creator solutions!

Categories

Have Any Question?

Do not hesitage to give us a call. We are an expert team and we are happy to talk to you.
ITECHLEADZ
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.