• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. richard.mortimer
    3. Posts

    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
    • Profile
    • Following 0
    • Followers 0
    • Topics 13
    • Posts 70
    • Best 2
    • Controversial 0
    • Groups 0

    Posts made by richard.mortimer

    • RE: Thanks and Goodbye ...

      I understand your sentiment @phildunlap - my old boss (and then bandmate) used to say something along the lines of "standing on the shoulders of giants you can see for miles" - and I wanted to express that I'm grateful for those who have loaned me their shoulders to stand on, because it doesn't always happen ...

      Cheers

      Richard

      posted in Mango feedback
      richard.mortimerR
      richard.mortimer
    • Thanks and Goodbye ...

      My contract comes to an end this week, so I (potentially) won't be working in the Mango space after that - just wanted to say "thanks" to all that helped me through my journey. Wishing you all the best ...

      Richard

      posted in Mango feedback
      richard.mortimerR
      richard.mortimer
    • RE: Pagination for a page

      @richard-mortimer said in Pagination for a page:

      @craigweb said in Pagination for a page:

      Hi Richard

      I believe, you do not need your query string function as there is already a component for this. You will need to register you page with the URL of ?page

       <ma-state-params on-change="PageStart = $stateParams.page; stateParams = $stateParams" update- 
       params="updateParams"></ma-state-params>
      

      Here is a help document that explains how to use it with a watchlist:
      https://help.infiniteautomation.com/linking-to-dynamic-pages

      Thanks for that, the PageStart variable is read in as what it should be, but seems to be overwritten when I'm reading in the Settings parameters (no matter where I put it on the page), so even when this is at the bottom of the page:

      <ma-state-params on-change="Settings.PageStart = $stateParams.page; stateParams = $stateParams" update-params="updateParams"></ma-state-params>
      

      And this is at the top:

      <ma-json-store xid="PageConfigXID" value="Settings"></ma-json-store><!-- page configuration data -->
      

      The value goes from 2 to 0 with this URL: http://mango2:8080/ui/richard-overview-angular?page=2

      Any idea how to make the value stick ... ?

      Scratch that - I've used two repeats - if the PageStart value doesn't exists - it displays the page as normal, but if it does exist, it does sends it to the second repeat and uses that value for the calculation of where to start the page. Kinda goes against the DRY prinicipal, but works effectively ....

      So, in the first instance:

      <div ng-if="!PageStart" class="table" ng-repeat="site in sites.sites | limitTo: Settings.PageSize : Settings.PageStart">
      

      And in the second:

      <div ng-if="PageStart" class="table" ng-repeat="site in sites.sites | limitTo: Settings.PageSize : (( PageStart - 1 ) * Settings.PageSize)">
      

      Cheers

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: Pagination for a page

      @craigweb said in Pagination for a page:

      Hi Richard

      I believe, you do not need your query string function as there is already a component for this. You will need to register you page with the URL of ?page

       <ma-state-params on-change="PageStart = $stateParams.page; stateParams = $stateParams" update- 
       params="updateParams"></ma-state-params>
      

      Here is a help document that explains how to use it with a watchlist:
      https://help.infiniteautomation.com/linking-to-dynamic-pages

      Thanks for that, the PageStart variable is read in as what it should be, but seems to be overwritten when I'm reading in the Settings parameters (no matter where I put it on the page), so even when this is at the bottom of the page:

      <ma-state-params on-change="Settings.PageStart = $stateParams.page; stateParams = $stateParams" update-params="updateParams"></ma-state-params>
      

      And this is at the top:

      <ma-json-store xid="PageConfigXID" value="Settings"></ma-json-store><!-- page configuration data -->
      

      The value goes from 2 to 0 with this URL: http://mango2:8080/ui/richard-overview-angular?page=2

      Any idea how to make the value stick ... ?

      Cheers

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: Pagination for a page

      A new requirement was added for the pagination; basically it needs to be callable by a query string added to the end of the URL called; so for example it wants to be http://mango_display_page?page=1 to show page 1; I've already got my JSON store sending through the start page as zero (called Settings.PageStart), which is assigned by <ma-json-store xid="PageConfigXID" value="Settings"></ma-json-store> - can I overwrite this value?

      I can grab the value and place it into a JavaScript function like this:

      var QS = function () {
        var query_string = {};
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
          var pair = vars*.split("=");
          if (typeof query_string[pair[0]] === "undefined") {
            query_string[pair[0]] = pair[1];
          } else if (typeof query_string[pair[0]] === "string") {
            var arr = [ query_string[pair[0]], pair[1] ];
            query_string[pair[0]] = arr;
          } else {
            query_string[pair[0]].push(pair[1]);
          }
        } 
          return query_string;
      } ();
      
      alert("x");
      //alert("x= " + Settings);
      //alert(QS.site);
      alert(QS.page);
      </script>
      

      How would I assign that to the AngularJS variable?

      Thanks

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: Disable an amChart series upon load

      @richard-mortimer said in Disable an amChart series upon load:

      I was asked to remove one of the series plot from the graph

      I was asked to add them back, so glad I asked the question, now it's fixed!!

      Cheers

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: Slider Problem

      I'm no expert on this, but when I've had difficulties with sliders, I've bound via the ng-model and added the gettersetter options thus:

      ng-model="Settings.TrendSet" ng-model-options="{getterSetter:true}"
      

      Hope that helps!

      Richard

      posted in User help
      richard.mortimerR
      richard.mortimer
    • RE: maJsonStore (JSON store)

      @mattfox said in maJsonStore (JSON store):

      @richard-mortimer I believe when you did | number:1 and | number:0 was more than sufficient. alternatively just use point.value.toFixed(1) and point.value.toFixed() repectively

      Thanks - the colon in the | number:1 was interfering with the ternary operator and getting it confused; so, while I could pipe it through, I couldn't modify the final number based on which direction it took - the point.value.toFixed(1) did the correct thing for me ...

      Cheers

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: maJsonStore (JSON store)

      @craigweb said in maJsonStore (JSON store):

      <span ng-repeat="point in points">
          <ma-get-point-value point-xid="{{ point.xid }}" point="output"></ma-get-point-value>
          <div>{{output.value >1000? output.value/1000:output.value}}{{output.value >1000?'kW':'W'}}</div>
      </div>
      

      Sorry, I missed this reply - you are correct it's inside a larger loop, which iterates through each device - I'm going to try the ternary operator and see how that goes ...

      Any idea how to put the number filter in there? The kW was to one decimal place, and the W was to 0 ...

      Cheers

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: maJsonStore (JSON store)

      @jared-wiltshire said in maJsonStore (JSON store):

      Two things -

      • Use track by in your ng-repeat expression so that Angular can correlate which points correspond to each span element when the points change.
      • Just pass the point to the <ma-get-point-value> component instead of retrieving it by XID again

      Thanks for that - I've made the changes and will keep an eye on it; unfortunately it only seems to happen at random times which makes it one of those "fun" bugs to iron out ... but I'm pretty confident that if you're pretty confident, it will probably be the right solution! :)

      Cheers!!

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: maJsonStore (JSON store)

      @mattfox said in maJsonStore (JSON store):

      Sorry Richard, I'm not seeing anything sticking out here.

      Fox

      That's cool - I'm kinda glad it wasn't something glaringly obvious, and I appreciate your help!!

      Getting a couple of errors, but I'm not sure they are related:

      0_1559720264023_console_output.jpg

      Cheers

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: maJsonStore (JSON store)

      {{output}} is:

      {
         "id":2986,
         "xid":"S2.DP_HOD-002_827990",
         "name":"Customer Load - Active Power",
         "enabled":true,
         "deviceName":"H02 - B-30",
         "readPermission":"RO, user",
         "setPermission":"",
         "pointFolderId":387,
         "purgeOverride":false,
         "unit":"W",
         "useIntegralUnit":false,
         "useRenderedUnit":false,
         "pointLocator":{
            "dataType":"NUMERIC",
            "settable":false,
            "modelType":"PL.PERSISTENT",
            "relinquishable":false
         },
         "chartColour":"black",
         "plotType":"SPLINE",
         "loggingProperties":{
            "loggingType":"ALL",
            "tolerance":0,
            "discardExtremeValues":false,
            "overrideIntervalLoggingSamples":false,
            "cacheSize":1
         },
         "textRenderer":{
            "useUnitAsSuffix":true,
            "unit":"W",
            "renderedUnit":"W",
            "format":"####.##",
            "suffix":"",
            "type":"textRendererAnalog"
         },
         "chartRenderer":{
            "timePeriod":{
               "periods":1,
               "type":"DAYS"
            },
            "type":"chartRendererImage"
         },
         "rollup":"NONE",
         "simplifyType":"NONE",
         "simplifyTolerance":10,
         "simplifyTarget":5000,
         "templateXid":null,
         "dataSourceId":116,
         "dataSourceXid":"DS_Central_T_E01",
         "dataSourceName":"Central-T-E01",
         "dataSourceTypeName":"PERSISTENT",
         "tags":{
            "SiteName":"S002",
            "Display":"Customer Load"
         },
         "lastPayload":{
            "xid":"SPS002.DP_HOD-002_827990",
            "event":"UPDATE",
            "value":{
               "dataType":"NUMERIC",
               "value":118,
               "timestamp":1559717556655,
               "annotation":null
            },
            "renderedValue":"118 W",
            "convertedValue":118,
            "enabled":true,
            "attributes":{
               "UNRELIABLE":false
            }
         },
         "value":118,
         "time":1559717556655,
         "convertedValue":118,
         "renderedValue":"118 W",
         "unreliable":false
      }
      

      Thanks

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: maJsonStore (JSON store)

      @mattfox said in maJsonStore (JSON store):

      {{ typeof output.value }} //although i'm not confident if it will work...
      

      Nope, that didn't work ... :(

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: maJsonStore (JSON store)

      @mattfox said in maJsonStore (JSON store):

      Evening Richard!

      Are your points numeric types or alphanumeric?

      I say keep it simple and just do

      <span ng-repeat="point in points[site.name]"><!-- Load -->
          <ma-get-point-value point-xid="{{ point.xid }}" point="output"></ma-get-point-value>
          <div ng-if="parseInt(output.value) > 1000">{{  parseFloat(output.value / 1000).toFixed(1) }}kW</div>
          <div ng-if="parseInt(output.value) <= 1000">{{ Number(output.value)}}W</div>
      </span><!-- end Load -->
      

      I believed they were simply numeric - but whern I add the parseInt(output.value) everything disappears (as in - neither ng-if statement is true), similarly the same with the Number and parseFloat functions ...

      If I do: <script>console.log(typeof {{output.value}});</script> I get:
      0_1559716204069_syntax_error1.jpg

      Cheers

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: maJsonStore (JSON store)

      Sorry to drag up an old subject, but I've got a curious thing happening within my repeats - and I'm not sure if it's an Angular issue, or I've done something to upset it ...

      My code used two ng-if statements to determine if the value is output value is in watts or kilowatts, thus:

      <span ng-repeat="point in points[site.name]"><!-- Load -->
          <ma-get-point-value point-xid="{{ point.xid }}" point="output"></ma-get-point-value>
          <div ng-if="output.value > 1000">{{ (output.value / 1000) | number:1 }}kW</div>
          <div ng-if="output.value <= 1000">{{ output.value | number:0 }}W</div>
      </span><!-- end Load -->
      

      The problem is - I'm sometimes getting two values returned, (for example 984W and 1kW) - if I directyly print the value on the screen via {{ output.value }} I'm seeing what I would expect to see (mostly integers, a couple of float types for some points).

      Am I doing something wrong here, or is there a better way to do this?

      [edit] Here's one I managed to catch as it happened:0_1559714978372_output_error.jpg

      Thanks

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: Remove date on mouseover from amCharts

      @mattfox said in Remove date on mouseover from amCharts:

      .amcharts-balloon-bg.amcharts-balloon-bg-categoryAxis,
      .amcharts-balloon-div.amcharts-balloon-div-categoryAxis
      {
      display:none!important;
      visibility:hidden!important;
      text-align: center;width: 0px;
      }

      Thank you, Mr Fox - perfect!!

      0_1559278750568_date_on_mouseover-fixed.jpg

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • Remove date on mouseover from amCharts

      Is it possible to remove the date from a mouse-over, as circled on my image below?

      0_1559269454805_date_on_mouseover.jpg

      Thanks

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: Listing email alerts for a specific device

      @phildunlap said in Listing email alerts for a specific device:

      Hi Richard,

      Jared's solution may be the correct one for the future.

      In the present, you can always do a general purpose technique like encoding that information into data points for use elsewhere. This thread sends an email for the last day's events, but it would show how to query the events from a script, currently. Then compose the JSON object you need to power your page and serialize it into an alphanumeric point.

      https://forum.infiniteautomation.com/topic/3147/email-last-day-s-events

      Cheers for that - is the first script on the page Java, or Javascript? Where would be the suggested place to store the script?

      Thanks

      Richard

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: Listing email alerts for a specific device

      @jared-wiltshire said in Listing email alerts for a specific device:

      I might try and sneak something like this into the 3.6 release for you.

      Thanks!!

      posted in Scripting general Discussion
      richard.mortimerR
      richard.mortimer
    • RE: Group objects into a user component

      I've been doing something similar to this - you may want to have a look at some of my previous posts to do the same; but in summary:

      • Use tags - if you have the same point in different devices use the device name as one tag and the function as a second

      • If your situation may have future additions, you can use a JSON store as the source of your devices

      • If your situation will be a low volume of new devices, you might want to use an ng-repeat using a range with your devices in; eg <div ng-repeat="device in range('Device1','Device2','Device3' ... 'DeviceN')">

      • Within that main div grab your point query with <ma-point-query query="'eq(tags.Device,'+device+')&eq(tags.Display,Point1)'" points="points[n]" ></ma-point-query><!-- data -->

      • Cycle through points[n] to find your specific data point value <span ng-repeat="point in points[n]"><ma-get-point-value point-xid="{{ point.xid }}" point="output"></ma-get-point-value>{{ output.renderedValue }}</span>

      Hope that helps to get you started ... !! I'm sure the learned people at IA will chime in with a better way than what I've done; but it may require you to start digging into the AngularJS side of things ....

      Cheers

      Richard

      posted in Wishlist
      richard.mortimerR
      richard.mortimer