• 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

    Set a point value from UI with the time as well

    Scheduled Pinned Locked Moved User help
    7 Posts 2 Posters 1.6k Views 2 Watching
    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.
    • MattFoxM Offline
      MattFox
      last edited by

      Hi guys, been a while since I've asked a question...

      Still using 3.5.6, I've got a dashboard page where the user wants to be able to set a point value however, I need to be able to set the day as well. This is usually for data entry for entering past weather events or future proposed events for forecast modelling....

      Is there a way I can set the point's value as well as the time it should be set? Or am I going to need a bit of hack?

      Fox

      Do not follow where the path may lead; go instead where there is no path.
      And leave a trail - Muriel Strode

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

        There is no existing component to do this, however I am sure the REST API supports it. I'll take a look how you could accomplish this.

        Developer at Radix IoT

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

          @MattFox Here's how you can do it, the key is sending a full point value time model to point.setValue()

          <div class="ma-designer-root" id="dd72786c-80c5-48c0-ab41-4dd3dd8eca33" style="width: 1366px; height: 768px; position: relative;" ng-init="page = {value: 1, time: ('' | maMoment:'toISOString'), annotation: 'my annotation'}">
              <ma-point-values id="c10062eb-a6f8-4cc3-a29a-2686b1b50a55" style="position: absolute; left: 451px; top: 61px;" point="page.point" values="page.values" realtime="true" latest="10"></ma-point-values>
              <div id="1c9d9a45-d671-4c49-ba87-4a67dee03a58" style="position: absolute; left: 346px; top: 112px; width: 336px; height: 267px;">
                  <div ng-repeat="pv in page.values | orderBy:'-timestamp' track by pv.timestamp">
                      {{pv.timestamp | maMoment:'format':'l LTS'}} — {{pv.value}} — {{pv.annotation}}
                  </div>
              </div>
              <ma-get-point-value id="61982987-65b8-4bd6-a36d-ddf6bce7d3ed" style="position: absolute; left: 38px; top: 35px;" point-xid="voltage" point="page.point"></ma-get-point-value>
              <ma-button id="2dffc568-97be-47b8-9978-3070d299acb5" raised="true" style="position: absolute; left: 56px; top: 297px;" label="Set point value" ng-click="page.point.setValue({value: page.value, timestamp: (page.time | maMoment:'valueOf'), dataType: page.point.dataType, annotation: page.annotation})"></ma-button>
              <md-input-container id="d1ea909d-f17d-476d-bdfd-d53129976f00" style="position: absolute; left: 30px; top: 96px;">
                  <label>Value</label>
                  <input type="number" ng-model="page.value">
              </md-input-container>
              <md-input-container id="f464df07-7044-43e9-9d47-428546d13b42" style="position: absolute; left: 30px; top: 156px;">
                  <label>Time</label>
                  <input ng-model="page.time">
              </md-input-container>
              <md-input-container id="f2489a90-6239-4c0a-a1b5-3b6e756340c5" style="position: absolute; left: 31px; top: 215px;">
                  <label>Annotation</label>
                  <input ng-model="page.annotation">
              </md-input-container>
          </div>
          

          Developer at Radix IoT

          MattFoxM 1 Reply Last reply Reply Quote 0
          • MattFoxM Offline
            MattFox @Jared Wiltshire
            last edited by

            @jared-wiltshire Gent! I'll give it a go. Was scrounging through the code at 9Pm and all I could deduce was placing a value, couldn't see any mention of using the timestamp as well.

            Do not follow where the path may lead; go instead where there is no path.
            And leave a trail - Muriel Strode

            1 Reply Last reply Reply Quote 0
            • MattFoxM Offline
              MattFox
              last edited by

              Ok, good news it works really well, cannot thank you enough for the assistance lately.
              I do have a possibly stupid question...
              If I were to try and amend a value by saving the value again at the same timestamp, will it overwrite?
              I have a feeling it may with the NoSQL DB, but I know for sure with my testing rig using the mysql database it'll probably double up.
              Any thoughts?
              My best idea is to remove the point value with the HTTP DELETE call then insert the newly amended value with the original timestamp.

              Do not follow where the path may lead; go instead where there is no path.
              And leave a trail - Muriel Strode

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

                Doesn't matter which database, it will overwrite the old value at that timestamp.

                Developer at Radix IoT

                1 Reply Last reply Reply Quote 0
                • MattFoxM Offline
                  MattFox
                  last edited by

                  Thanks, I might have to test, I seem to have doubling up...

                  Do not follow where the path may lead; go instead where there is no path.
                  And leave a trail - Muriel Strode

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