• 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

    Formatting 'converted' point values

    Scripting general Discussion
    3
    8
    2.1k
    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.
    • richard.mortimerR
      richard.mortimer
      last edited by

      Hi,

      If I have a point value I get from the Mango device, for example:

      <ma-point-value point-xid="{{ Objects.BattCharge }}"></ma-point-value> it returns 22.5 %

      When I add a display-type=converted such as:

      <ma-point-value display-type="converted" point-xid="{{ Objects.BattCharge }}"></ma-point-value> the value often comes back as 22.500000001 - is there any way to format the number that comes back via this point?

      The desired result is 22.5% (without the space, and only to one decimal place).

      Thanks

      Richard

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

        Setting display-type="converted" will make it display the raw numeric value as you discovered. You want to use the rendered value which is controlled by the data point's text renderer. When you have the analog text renderer selected and "Use unit symbol as suffix" is set it inserts a space between the number and the unit symbol. If you want to get rid of this space, uncheck "Use unit symbol as suffix" and set the suffix manually.

        Developer at Radix IoT

        1 Reply Last reply Reply Quote 0
        • richard.mortimerR
          richard.mortimer
          last edited by richard.mortimer

          Found a different (better?) way to do this; find your data point initially and assign it to a variable:

          <ma-get-point-value point-xid="{{ Objects.BattTemp }}" point="DispBattTemp"></ma-get-point-value>
          

          then further down the page, use this array to grab the value, then filter it via the AngularJS built in number thus:

          <span ng-if="showBattTemp"> ({{ DispBattTemp.value | number:1 }}&deg;C)</span>
          

          Outputs 19°C as required. (Sorry, changed the data point from the initial example, but the theory is the same)

          Cheers

          Richard

          1 Reply Last reply Reply Quote 0
          • richard.mortimerR
            richard.mortimer
            last edited by richard.mortimer

            The only down side seems to be that the flash-on-change="true" directive no longer works ... :(

            Jared WiltshireJ 1 Reply Last reply Reply Quote 0
            • Jared WiltshireJ
              Jared Wiltshire @richard.mortimer
              last edited by Jared Wiltshire

              @richard-mortimer said in Formatting 'converted' point values:

              The only down side seems to be that the flash-on-change="true" directive no longer works ... :(

              Just one of quite a few reasons I recommended a different method.

              Developer at Radix IoT

              richard.mortimerR 1 Reply Last reply Reply Quote 0
              • richard.mortimerR
                richard.mortimer @Jared Wiltshire
                last edited by

                @jared-wiltshire said in Formatting 'converted' point values:

                @richard-mortimer said in Formatting 'converted' point values:

                The only down side seems to be that the flash-on-change="true" directive no longer works ... :(

                Just one of quite a few reasons I recommended a different method.

                There are quite a number of people that work on our systems, with varying degrees of experience and knowledge. Whilst the flash-on-change might not be a valid reason to modify the final output, I'd be curious as to the other reasons, to see whether there would be valid reasons to suggest a change to this?

                Thanks

                Richard

                Jared WiltshireJ 1 Reply Last reply Reply Quote 0
                • CraigWebC
                  CraigWeb
                  last edited by

                  I really like the pop up of the <ma-point-value point="myPoint1" enable-popup="up"> when enable pop is used.Not sure if you have tried it out yet.

                  1 Reply Last reply Reply Quote 0
                  • Jared WiltshireJ
                    Jared Wiltshire @richard.mortimer
                    last edited by

                    @richard-mortimer said in Formatting 'converted' point values:

                    I'd be curious as to the other reasons, to see whether there would be valid reasons to suggest a change to this?

                    If you change the suffix as I suggested you will see the change anywhere that the point value is displayed, i.e. on any dashboard (without explicitly formatting it), on any report, on any email, on any built in Mango page such as Watchlists etc.

                    You also get the benefits that <ma-point-value> provides such as the popup Craig mentioned, the flash on change, the unreliable indicator, the event indicator and the red cross hatching when the data point is disabled etc.

                    Developer at Radix IoT

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