Understanding how to manipulate and work with subforms in Zoho Creator can drastically enhance the efficiency and functionality of your business applications. One such manipulation involves updating a unit price based on product selection within a subform. This guide will explain this procedure in detail.
The logic execution sequence for achieving this task in Zoho Creator is similar to adding a script to a regular form: On Add, On Delete, On User Input. However, there are subtle differences in the coding and how to embed the script into a subform.
Embedding Scripts in Subforms vs. Regular Forms
In a regular form, you have several scripting options such as Script Builder, Free Flow, and Form Definition. These options allow you to write the code manually if you are proficient in doing so. In contrast, a subform doesn't have a Script Builder. Instead, users must manually write the code using a Free Flow approach style.
The workaround is to write the code using the Script Builder in a regular form, save it from a free flow screen, and then insert it into the corresponding subform action.
Consider the image below, which displays an Order Management Form with standard product fields and its Unit Price. It also includes a subform that aggregates products in a similar manner. We created a script to update the Unit Price based on the Product selection for this example.
Comparing the code lines that update the fields on the right (regular form) to the ones on the left (subform), you'll notice they're nearly identical. This similarity provides a fantastic opportunity to quickly incorporate scripts into any subform.
Here's a practical tip: write the script on a regular form, then paste it into the subform and correct the subtle difference.
Key Takeaway
This process makes updating a unit price based on product selection in a Zoho Creator subform simpler and more streamlined. Don't forget to experiment with this method and tweak it according to your business needs.
For more detailed information on using Zoho Creator, check out our other blog posts or visit the official Zoho Creator documentation.