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 calculation happening based on the input they enter; provides a better user-experience.

    Set the field type 

    Define your formula field's type — single line type or multi-line type, for string type of expressions. Single line formula field type supports only upto 255 characters and Multi-line formula field type supports (upto 65355 characters) multiple lines of formula but with some particular limitations (refer below table).



    The following are the behaviors shown by single line formula field type and multi-line formula field types.

    Module

    Property

    Supports New Single Line Formula

    Supports New Multi-Line Formula

    Form

    Lookup Display Field

    Yes

    No

    Lookup Advanced search

    Yes

    No

    Subform Field Based Sort

    Yes

    No

    Report

    Criteria Builder across modules(set criteria)

    Yes

    No

    Grouping

    Yes

    No

    Sorting

    Yes

    No

    Search

    Yes

    No

    Deluge

    Criteria filter

    Yes

    No

    Aggregate records (Count ,Sum, Distinct Count, Maximum, Minimum)

    Yes

    No

    Pages

    Panel/Gauge - Distinct Count

    Yes

    No

    Chart - X, Y axis

    Yes

    No

    API

    Criteria Usages

    Yes

    No

    Mobile

     

     

     

    Search in reports

    Yes

    No

    Grouping in reports

    Yes

    No

    Sorting in reports

    Yes

    No

    Search

    Yes

    No 


    Note:
    • When switching from multi-line field type to single line field type, the values of the multi-line formula field will be truncated to fit the maximum limit of 255 characters. 
    • The existing formula fields will remain as a single line field without any limitations, until the field type property is changed. All the newly added formula fields will be single line by default with the option to change the field type.

    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:

    Requirement Expression Explanation
    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:

    Expression Data type Explanation
    2 + 3
    Bigint When the arithmetic operator (+) operates on numbers, it adds them. The result (5) is a number.
    "2" + "3"
    String Characters 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()
    Bigint Characters 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
    Timestamp zoho.currentdate is a Deluge system variable that returns the current date. The result is a date value.
    2 > 3
    Boolean When 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 on form submission.
    • 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
    • You switch the field types from single line to multi-line field type or vice versa.
    • 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.



    Access your files securely from anywhere

      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


              Zoho Sign now offers specialized one-on-one training for both administrators and developers.

              BOOK A SESSION





                          Quick Links Workflow Automation Data Collection
                          Web Forms Enterprise Begin Data Collection
                          Interactive Forms Workplace Data Collection App
                          CRM Forms Customer Service Accessible Forms
                          Digital Forms Marketing Forms for Small Business
                          HTML Forms Education Forms for Enterprise
                          Contact Forms E-commerce Forms for any business
                          Lead Generation Forms Healthcare Forms for Startups
                          Wordpress Forms Customer onboarding Order Forms for Small Business
                          No Code Forms Construction RSVP tool for holidays
                          Free Forms Travel
                          Prefill Forms Non-Profit

                          Intake Forms Legal
                          Mobile App
                          Form Designer HR
                          Mobile Forms
                          Card Forms Food Offline Forms
                          Assign Forms Photography
                          Mobile Forms Features
                          Translate Forms Real Estate Kiosk in Mobile Forms
                          Electronic Forms

                          Notification Emails for Forms Alternatives Security & Compliance
                          Holiday Forms Google Forms alternative  GDPR
                          Form to PDF Jotform alternative HIPAA Forms
                          Email Forms
                          Encrypted Forms
                          Embeddable Forms
                          Secure Forms
                          Drag and Drop form builder
                          WCAG


                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                Manage your brands on social media

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    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 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 Price and Ordered Quantity ...
                                                                                                              • Understand fields

                                                                                                                Understand fields Note: Ensure to not enter sensitive terms while naming your form fields or collect confidential information in them. A field is the basic unit or building block of a form. In your Zoho Creator app, you collect and store data using ...
                                                                                                              • Understand Forms

                                                                                                                1. What Does This Page Cover? Learn about forms and how they are used to collect and store data in Creator. 2. Availability Forms built from scratch, by importing data, and from a template can be created in all plans of Creator, while integration ...
                                                                                                              • 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 ...
                                                                                                                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