• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    How To Copy point data to a scripting point

    How-To
    2
    11
    2.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • phildunlapP
      phildunlap
      last edited by

      Hi Phillip,

      1. Does this scripting data source have "Saves historic" checked? (I guess yes)
      2. How are you assessing how many points were created? The number of values PointCopy has? How long did you wait after running the script?
      3. Is your script difficult to disable once enabled? (I guess no)

      My intuition suggests you didn't wait long enough after the script ran for the values to appear, but you could enable logging in the script and put in LOG.info("Copied: " + copied " + " point values."); to get log messages into Mango/logs/scripting-[data source id].log

      Values that are not new values (latest timestamps in the series) can take a minute or two (actually configurable) if you're using the NoSQL module to appear, as it is more efficient to wait for the backdates to accumulate than insert them one at a time. That could be what you're seeing? It could also be the logging type of the CopiedPoint is not "All data" and it's something to do with that.

      1 Reply Last reply Reply Quote 0
      • P
        Phillip Weeks
        last edited by

        Phil; I have the script copying now and writing to a log file, perhaps I was not waiting long enough. Yes, I control the script running with flags as you noticed, so pretty easy to enable and disable them.
        I am still trying to validate the interpolate script you helped me with as working correctly on this copied point before I implement it on the original modbus data.
        In testing the script I get duplicates entries for the same timestamp. Is this normal because I thought a point.set with a timestamp that existed would overwrite that value. how do I prevent duplicates?

        Also other than the sparse documentation is there a complete and detailed documentation on the objects, properties and methods exposed? I seem to be learning this data paradigm piece-meal. Thanks in advance.

        1 Reply Last reply Reply Quote 0
        • phildunlapP
          phildunlap
          last edited by

          Do you have the mangoNoSqlDatabase module installed?

          This article is a useful introduction to Mango's JavaScript: http://help.infiniteautomation.com/support/solutions/articles/14000022520-about-mango-java-script

          It's a reproduction of the contextual help in the related items for most things which have scripts (click blue ? on data source edit page, scroll to the bottom, click "Mango Java Script")

          1 Reply Last reply Reply Quote 0
          • P
            Phillip Weeks
            last edited by

            @phildunlap said in How To Copy point data to a scripting point:

            mangoNoSqlDatabase
            Do we require the mangoNoSqlDatabase module do to solve this duplicate issue?
            I googled mangoNoSqlDatabase and get no results at all related to mango. NOTHING.
            Even on the MANGO help site it returns virtually nothing about mangoNoSqlDatabase .
            AND I have read those pages you directed me to, and nothing on duplicate records.

            1 Reply Last reply Reply Quote 0
            • phildunlapP
              phildunlap
              last edited by

              Hi Phillip

              I foresaw the duplicate values if you are not using NoSQL in the original thread: http://infiniteautomation.com/forum/topic/2724/how-to-handle-missing-datapoints/3

              To check if you have the module installed, you would navigate to the /modules.shtm page in the browser and see if it's in the list.

              1 Reply Last reply Reply Quote 0
              • P
                Phillip Weeks
                last edited by

                no its not in the list :(
                I'm guessing it is required to prevent duplicates?

                1 Reply Last reply Reply Quote 0
                • phildunlapP
                  phildunlap
                  last edited by

                  Yes, you cannot have two values at the same millisecond using the NoSQL module, the latest insert prevails.

                  1 Reply Last reply Reply Quote 0
                  • phildunlapP
                    phildunlap
                    last edited by

                    You may want to use the Data Import module to delete the duplicates. You can export the point values on the Data Point Details page and mark rows to be removed, then import on /dataImport.shtm

                    1 Reply Last reply Reply Quote 0
                    • P
                      Phillip Weeks
                      last edited by

                      Even without this module I am wondering why it duplicates points because we only set points with a timestamp + interval where there was no timestamp within the interval of the current point so this should not create duplicates should it?

                      1 Reply Last reply Reply Quote 0
                      • phildunlapP
                        phildunlap
                        last edited by

                        I can't say. I did some testing and while I have to correct some other errors in what I provided you it didn't seem to have any issues that would have caused duplication points. There was an issue with the variable name passed to the interpolation function, though. The updated version of that script is in the other thread.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post