• 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

    Script context points as enumerable

    Development general discussion
    4
    7
    1.2k
    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.
    • T
      till
      last edited by

      Hi,
      I was wondering if there is any way to iterate over all context points in a meta datapoint script, without spelling them out?
      I want to write a generic script that is oblivious to them but can still access their values.
      E.g. dumping all their values to an error log if something goes wrong.
      Thanks

      Jared WiltshireJ 1 Reply Last reply Reply Quote 0
      • Jared WiltshireJ
        Jared Wiltshire @till
        last edited by

        @till yes, have a look at the meta data source help. This is how you iterate over. Be aware that the meta point itself is contained in CONTEXT_POINTS.

        for (var variableName in CONTEXT_POINTS) {
            print(CONTEXT_POINTS[variableName]);
        }
        

        Developer at Radix IoT

        1 Reply Last reply Reply Quote 0
        • T
          till
          last edited by

          Sweet, thanks!

          T 1 Reply Last reply Reply Quote 0
          • T
            till @till
            last edited by till

            So I found this on CONTEXT_POINTS

            CONTEXT_POINTS
            CONTEXT_POINTS is a variable declared in all scripting environments. It is a map of variable names to context point runtimes.
            

            Is there more documentation somewhere?

            .

            Your example gives me a list of elements like this:

            DataPointRT(id=1, name=MyPoint)
            DataPointRT(id=2, name=MyOtherPoint)
            

            From there, how do I get to the full datapoint details, like value, last value, timestamp etc?

            Where do I find out more about context point runtimes

            Thanks

            dschaibleD Jared WiltshireJ 2 Replies Last reply Reply Quote 0
            • dschaibleD
              dschaible @till
              last edited by

              @till I am not 100% sure, but is this the type of information you need:

              http://docs-v4.mango-os.com/about-mango-java-script

              This is the main documentation site: http://docs-v4.mango-os.com/

              1 Reply Last reply Reply Quote 0
              • Jared WiltshireJ
                Jared Wiltshire @till
                last edited by

                @till try this -

                for (var variableName in CONTEXT_POINTS) {
                    print(this[variableName]);
                }
                

                Developer at Radix IoT

                T 1 Reply Last reply Reply Quote 1
                • T
                  till @Jared Wiltshire
                  last edited by

                  @jared-wiltshire perfect, thanks!

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