Understanding Previous Value Function

Understanding Previous Value Function

A key function in creating a realtime datapoint with computation is the previous value function. This function allows you to utilize the last stored value in the datapoint time series allowing the computation of delta values.
When a realtime datapoint that incorporates the PREVIOUS_VALUE function in a computation is first executed, the initial computed value stored is zero.

Here is simple example of how the datapoint value is stored for each computation for the simple expression. As new JSON payloads arrive, the value from the most recent payload is extracted and becomes the Previous Value, which is then used in the new computation.



Let's consider an example where a gateway device sends fuel level values as payload. From this payload, a fuel level datapoint is created to store the fuel levels. Now, a computed realtime datapoint named 'Fuel Consumed' can be created to log the amount of fuel used at each instance. The expression for this computation will be as below.



Below is a table showing example payload values along with the computed values stored in the datapoint for this expression.

 
Received Value
(from Payload)
Previous Value
Computed and Stored (Fuel Consumed)
Payload 1
100
-
-
Payload 2
90
100
100 - 90 = 10
Payload 3
75
90
90 - 75 = 15
Payload 4
63
75
75 - 63 = 12
Payload 5
48
63
63 - 48 = 15
Payload 6
33
48
48 - 11 = 15
 
When visualized using the data explorer, the data will appear as follows.



The violet bar represents the fuel level value (extracted from the payload), and the pink bar represents the fuel consumed value (computed using expression) at defined intervals.

    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 Alarms

                                                                                                            Identifying faults in devices and assets within an IoT network is the most vital part of any monitoring application. It provides insight into the health of devices and assets, and consequently, the overall health of the network. This capability ...
                                                                                                          • Understanding Locations

                                                                                                            Introduction to Location In Zoho IOT, a location represents a physical place with multiple devices and assets located under it. Each location can function as either a parent location having one or more child locations, and a child location can ...
                                                                                                          • Understanding Actions

                                                                                                            In an IoT setup, you may have to trigger various actions, such as sending notification emails to relevant personnel, connecting to a third-party URL via. webhook, or executing custom business logic on certain conditions. These actions are generally ...
                                                                                                          • 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 ...
                                                                                                          • Understanding Image Widgets

                                                                                                            Image type widgets are used to display the value of a property along with an appropriate image. You can choose from a list of styles such as Simple Image, Image with Metrics, Image with Comparison Metrics, and Image with String Metrics widgets. The ...
                                                                                                            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