Understand Formula Field | Zoho Creator Help

Understand formula field

The Formula field enables you to automatically generate a value for each record in your form, based on a predefined expression.

Let's take an example. The Total Amount in an Order form is calculated based on the Unit Price and Quantity of the ordered items. Instead of writing workflows to achieve this, you'd save a lot of time and effort by using the formula field. In addition to such mathematical operations, your requirements may include text-based operations like concatenation of the data in two fields, or date-based operations like finding the number of days between two dates. It's for such requirements (and more) that Zoho Creator has in store the Formula field.

As the formula field's value is calculated, it is not displayed in the form by default. You can make it visible if required. Learn more

Features

Making the formula field visible in the form

As the value of the formula field is calculated and not entered by your users, it is by default not displayed when your users access your form. You can make it visible if required. Learn how

Things to know:

  • When you display the formula field in the form, it will appear disabled — indicating to your users that they cannot enter an input in it
  • When your formula field refers to other fields in the form, it makes sense to let your users view the calculated value before they submit your form. Tip: Try to place the formula field near the fields it refers. This will help your users understand that there's a calcualtion happening based on the input they enter; provides a better user-experience.

Defining the formula field's expression

Defining a formula field's expression starts with defining what value is the field to display. Refer to this page to learn more about defining expressions for formula fields.

Though formula field may be used to simply display a string constant like abcd or a numeric constant like 123. However, in most cases you would want to perform calculations based on field values. Refer to the following examples:

RequirementExpressionExplanation
Calculate the Amount based on the product's Unit Price and Quantity
Unit_Price * Quantity
The arithmetic operator (*) multiplies the values stored in the two fields.
Concatenate the Last Name and Email address of an employee
Name.last_name + Email_address
Name is a composite field. last_name is the link name of the Last Name field. The arithmetic operator (+) concatenates the string values stored in the two fields.
Calculate the Average Marks scored by a student based on their scores in MathEnglish, and Science
(Math + English + Science) / 3
Math, English, and Science are field link names. The arithmetic operators + (addition) and / (division) have been used. The parentheses () helps define the order of execution of the two operations.

Data type of a formula field

Each field in Zoho Creator is associated with a data type. The formula field is unique in this regard — its data type is decided upon the evaluation of its expression. For example:

ExpressionData typeExplanation
2 + 3
BigintWhen the arithmetic operator (+) operates on numbers, it adds them. The result (5) is a number.
"2" + "3"
StringCharacters enclosed in double quotation marks are considered as a string. When the arithmetic operator (+) operates on strings, it concatenates them. The result (23) is a string.
"abcd".length()
BigintCharacters enclosed in double quotation marks are considered as a string. length() is a built-in function that returns the number of characters present in a string. The result (4) in a number.
zoho.currentdate
Timestampzoho.currentdate is a Deluge system variable that returns the current date. The result is a date value.
2 > 3
BooleanWhen the relational operator (>) operators on the numbers 2 and 3, it checks if the relation is true or not. As 2 is not greater than 3, the result is false — a boolean value.

Calculation of the formula field's value

The value displayed by a formula field is the evaluation of its expression. This value is calculated when your users submit your form.

When you make the formula field visible on the form, your users will be able to view the calculated value (before they submit the form) depending on whether or not the expression includes fields.

  • When the formula field's expression does not include fields, the calculated value will be displayed when your users enter an input (while submitting an entry) or modify the data in any one of fields (while editing an entry) in that form. Even if users do not enter or modify any data, the formula field's value is calculated when you users submit your form.
  • When the formula field's expression includes fields, the value will be calculated only when none of the fields store null

When field values are null

Unless a field is made mandatory on the form, it can remain empty (i.e., without data) in many records. Zoho Creator assigns such empty fields with the value null. When a field in a record stores null, Zoho Creator interprets that there's no value in the field (in that record). When your formula field's expression includes fields which can be null, its expression may not be evaluated (as mentioned above).

The following type of fields can contain nullnumberdecimalcurrencypercentdatedate-time. Text-based fields like single linenameemailaddress, never contain null. When they are empty (or store no data), they are considered as strings containing zero characters. To ensure that your formula field always has a value for it, you must define a conditional expression.

Recalculation of the formula field's value

The formula field's value will be recalculated when:

  • You modify the field's expression
  • Your users edit records in bulk and one of fields being edited is part of that formula field's expression
Note: Modifying the formula field's expression will initiate a recalculation in all records that form contains. This recalculation can take some time when multiple records are involved.

Set display format for reports

When your formula field's data type is string, you can define the format in which its data is to be shown in reports. This is defined by its Display format in reports property. Learn how

Choosing to display formula field's data in reports as plain text may benefit the performance as the system gets to skip checking it for invalid HTML tags.



    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now


            Get started with Zoho Sign

            in a few quick steps!

            Download Help Guide





                        Still can't find what you're looking for?

                        Write to us:  support@zohoforms.com


                              




                            

                          Zoho Marketing Automation

                            Zoho Sheet Resources

                             




                                Zoho Forms Resources


                                  Secure your business
                                  communication with Zoho Mail


                                  Mail on the move with
                                  Zoho Mail mobile application

                                    Stay on top of your schedule
                                    at all times


                                    Carry your calendar with you
                                    Anytime, anywhere




                                          Zoho Sign Resources

                                            Sign, Paperless!

                                            Sign and send business documents on the go!

                                            Get Started Now


                                                Zoho SalesIQ Resources



                                                    Zoho TeamInbox Resources



                                                            Zoho DataPrep Resources



                                                              Zoho DataPrep Demo

                                                              Get a personalized demo or POC

                                                              REGISTER NOW


                                                                Design. Discuss. Deliver.

                                                                Create visually engaging stories with Zoho Show.

                                                                Get Started Now











                                                                                      • Related Articles

                                                                                      • Understand lookup field

                                                                                        Understand lookup field The lookup field enables you to create a relationship between forms. Using this relationship you will be able to lookup data from another form in the same application or from a form in a different application in your Zoho ...
                                                                                      • Understand expression

                                                                                        Understand formula field's expression The formula field's Expression is what defines the value it will store and display. For example, the Amount field in an Order form is usually a result of multiplying the values in Unit ...
                                                                                      • Understand field rules

                                                                                        The script actions in the field rules event will help you in defining the behavior of the fields in the form. There are multiple actions which can be associated with the field rules event. They are: Show field - This will make the field visible to ...
                                                                                      • Understand fields

                                                                                        Understand fields A field is the basic unit or building block of a form. In your Zoho Creator app, you collect and store data using  forms  and each field in a form holds an individual piece of that data. For example, a form to collect the contact ...
                                                                                      • Understand OCR field

                                                                                        The OCR field enables you to perform optical character recognition on an image. In other words, it extracts text from the images stored in an image field. For example, you can use the OCR field to extract the text from the images of invoices, ...
                                                                                      Wherever you are is as good as
                                                                                      your workplace

                                                                                        Resources

                                                                                        Videos

                                                                                        Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                        eBooks

                                                                                        Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                        Webinars

                                                                                        Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                        CRM Tips

                                                                                        Make the most of Zoho CRM with these useful tips.



                                                                                          Zoho Show Resources