Understanding Expression Builder for Datapoints

Understanding Expression Builder for Datapoints

Expression builders are used to create expression for computing values based on a set of available datapoints, fields, or constants and storing them as realtime or scheduled KPI datapoints.

Note: Expression builder is available by default for Scheduled KPI datapoints. It will become available to Realtime Datapoints on enabling computation allowing for realtime expression computation.



The three components of an expression builder are expressions, variables, and operators.

Expression: An expression can contain up to two variables linked by a single mathematical operator for a single row and can consist of up to five rows, sequentially labelled from A to E. The final expression is constructed using the labels of these rows.


Mathematical Operator: Plus, Minus, Multiply, and Divide are the four supported mathematical operators.



Variables: Variables hold the value to be used in the expression. A variable can be one of the four options: Constant, Datapoint, Field, Parsing Key.

Constant: Numeric value provided by the user. This value will remain constant for all computations.
For example, consider a simple expression used in a datapoint that needs to store the temperature in Kelvin.



Here, the value 273.15 will be the same irrespective of the temperature value in Celsius; values like 273.15 are provided as constants.

Field: A field configured to accept numerical input from the user that can be utilised in further evaluations and computations.

For example, consider an expression used to calculate energy per person, where the daily count of people must be manually input. This data is entered into a field labelled "Today's Head Count."



Parsing Key: Value corresponding to the parsing key fetched from the telemetry JSON object.

For example, consider a JSON payload where the temperature is sent in Kelvin, but you need a datapoint to store the value in Celsius. You can use the parsing key of the JSON object as a variable and then compute the value.



Note: Parsing Key option is not available for Scheduled KPI Datapoints

Datapoint: Value stored in other available datapoint.

For example, consider a scenario where you need a datapoint for power, and you already have the datapoints for current and voltage. You can use them to create the Power Datapoint with the following expression.



In Realtime Datapoints, selecting the datapoint option during configuration allows the value from the datapoint to be used as-is or reprocessed using one of the available mathematical functions. Below is a list of these functions.



 
Function
Description
SIN
Uses the sine value of the datapoint
sin(datapoint_value).
COS
Uses the cosine value of the datapoint
sin(datapoint_value).
TAN
Uses the tan value of the datapoint
sin(datapoint_value).
SQRT
Uses the square root value of the datapoint.
ABS
Uses the absolute value (non-negative value) of the datapoint.
CEIL
Uses the value rounded up to the nearest integer.
FLOOR
Uses the value rounded down to the nearest integer less than or equal to the datapoint value.
ROUND
Uses the value rounded to the nearest integer. Rounds up if the decimal is 0.5 or more; rounds down if the decimal is less than 0.5.
PREVIOUS_VALUE
Retrieves and uses the value of the datapoint from the previously received value.
Learn more about the previous value function.
 
In Scheduled KPI datapoints, selecting the datapoint option allows you to choose aggregation functions and time periods for these aggregations.

Learn more about the functions available in Scheduled KPI Datapoints.

Similarly, for Scheduled KPI Datapoints, related datapoints will become available for selection.

Learn more about Related Datapoints.

How to build an expression?

Expression are created while creating or configuring a new datapoint.
For a basic expression, fill two variable fields in a row with an operator to compute a value.
Consider a JSON payload where the distance is measured in centimetres but needs to be converted to millimetres.


You can use the expression builder for a straightforward calculation. Since 1 cm equals 10 mm, multiplying the received value by 10 converts it to millimetres. Set up the expression as follows:
  1. Add a variable with the parsing key, and input the parsing key, distance.
  2. Choose the multiplication operator
  3. Add a constant value of 10 in the second variable field


The expression will now store a computed value of 100 in the datapoint.

For complex calculations where you need to perform multiple calculations on a value to be stored, you can use multiple rows and edit the expression of the row labels.

For instance, consider a JSON message where the temperature value is sent in Fahrenheit, but you want to store data in Celsius.



Now, the formula for converting Fahrenheit to Celsius: (F - 32) * 0.55.

To achieve this computation,

In the first row,
  1. Add the parsing key variable with value temp_F
  2. Choose the Subtraction operator.
  3. Add a constant variable of 32.


Then, in the second row,
  1. Add a constant variable of 0.55.



Now, In the expression editor,
  1. Create the formula A*B.

Based on the expression, the resulting value stored in the datapoint will be 32.22
.



Another example is calculating water usage in an agricultural setup. Here, the water consumed is stored in a datapoint, and the number of plants watered can change and is manually entered in a field called "Plants Watered." An expression can be created to calculate the water usage per plant as follows:


    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











                                        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

                                                                                                          • Understanding Datapoints

                                                                                                            Datapoint is a unique time series data represented as a time stamped key- value pair, and is available for assets, devices, and locations in the Zoho IOT application. It is the source of data for other features in the application and is vital in ...
                                                                                                          • Understand Scheduled KPI Datapoints

                                                                                                            Scheduled KPI Datapoints are computed values based on expressions, with datapoint values from the same model, related models, and field configured for the model, aggregated using a function over a period. These expressions are executed at defined ...
                                                                                                          • Understanding Fields

                                                                                                            In Zoho IOT applications, fields are essential components used to collect data as input from users. These fields serve as the primary means through which users can manually provide information to the application. Fields are available on the details ...
                                                                                                          • Configuring Fields: Datapoints

                                                                                                            This guide outlines the steps to configure various fields when creating a datapoint. Each section details the options available and provides examples for clarity. Field Description Example Datapoint Type Options: Choose between Realtime Datapoint or ...
                                                                                                          • Understanding Timeline Widgets

                                                                                                            Timeline type widgets are used to view datapoint values from devices in a time-based sequence. They provide a clear and intuitive way to track and understand trends, events, and changes that occur over time. The two different Timeline widget formats. ...
                                                                                                            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