Back to blog
Article

How to fetch a field value from the row above in a “Sub-form”

How to fetch a field value from the row above in a “Sub-form” The Question: Is there a way to fetch a field value from the row above in a subform and input into the row below? The Answer: You need to think about the...

AorBorC field note / Last reviewed July 9, 2026

2m
Read time
Feb
Published
How to fetch a field value from the row above in a “Sub-form”

How to fetch a field value from the row above in a “Sub-form”

The Question:

Is there a way to fetch a field value from the row above in a subform and input into the row below?

The Answer:

You need to think about the ways to identify the previous row. One way is to assign a custom row ID (On Add Row) for each row and get value based on that row ID. Another way is to get value based on multiple field value combo (Product Category and Product, for example). Depending on whichever way works best for you, you can write the script.

Below workflow will allow you to assign a custom row ID and get values based on that.

1) Create the Row ID field in the SubForm (Row_ID as field deluge name)

2) In the parent Form (where the SubForm is placed) go to On Add Row of the SubForm field and add the below script.

max_row_id = 0;
//Find the previous max row ID
for each subform_row in input.SubForm
    {
        if(subform_row.Row_ID > max_row_id)
        {
            max_row_id = subform_row.Row_ID;
        }
    }                  
//Assign the row id for current row
row.Row_ID = max_row_id + 1;

3) In the on user input of SubForm’s field, you can identify the previous row id and then assign the value to the current row. Below script does exactly that.

prev_row_id = row.Row_ID – 1;                       
//Find the previous max row ID
for each subform_row in input.SubForm
    {
        if(subform_row.Row_ID == prev_row_id)
            {
                row.Field_Name = subform_row.Another_Field //add expressions here
            }
    }

if a row above is deleted, you will need to handle delete action as well.

Next step

Need help mapping this workflow?

Start with the workflow, roles, decisions, and system handoffs. AorBorC can map the operating problem, identify the right build path, and define a practical first phase before your team commits to implementation.

Related Articles

December 3, 2024

Zoho CRM: Field Mapping with Deluge

Learn how to automate data transfers in Zoho CRM using Deluge scripting for efficient field mapping and error reduction.

Read article

February 12, 2021

How to keep XML RPC API Auth Token private in a public form?

XML RPC API Auth Token The Problem: You have a public form that we wish to add records into a creator application including is’t subform). You are able to successfully submit our form data into Creator using the XML...

Read article