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.



The following table shows 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.

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        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 LinksWorkflow AutomationData Collection
                              Web FormsRetailOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceForms for Solopreneurs
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit
                              Forms for Government
                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic FormsInsurance
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsWufoo alternativeEncrypted Forms
                              Accessible FormsTypeform alternativeSecure Forms

                              WCAG

                                          Create. Review. Publish.

                                          Write, edit, collaborate on, and publish documents to different content management platforms.

                                          Get Started Now






                                                            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

                                                                  Use cases

                                                                  Make the most of Zoho Desk with the use cases.

                                                                   
                                                                    

                                                                  eBooks

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

                                                                   
                                                                    

                                                                  Videos

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

                                                                   
                                                                    

                                                                  Webinar

                                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                                   
                                                                    
                                                                  • Desk Community Learning Series


                                                                  • Meetups


                                                                  • Ask the Experts


                                                                  • Kbase


                                                                  • Resources


                                                                  • Glossary


                                                                  • Desk Marketplace


                                                                  • MVP Corner



                                                                    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 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 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 ...
                                                                                                                            • Understanding Chart Widgets

                                                                                                                              Charts play a vital role in displaying live and historical data from devices and assets for data visualization and data analysis purposes. Zoho IOT provides a wide range of chart type widgets to showcase these data in colorful and appealing 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