• phildunlap

    Hi Craig,

    Can you try "," as the delimiter when importing from / exporting to CSV in Excel?

    posted in User help read more
  • phildunlap

    Hi sbaik,

    Building the module with more date picker options is one possibility: https://github.com/infiniteautomation/ma-dashboards/blob/main/UI/web-src/ngMango/directives/dateRangePicker.js

    I think you would also find it do-able to modify the Mango/web/modules/mangoUI/web/mangoUi~ngMango.js file to add entries appropriate to Last 2/3 Days where you find LAST_1_DAYS

    Then you would need to do this again should you update the Mango UI module. There may be a better solution...

    Edit: You'll probably need to clear your browser cache.

    posted in User help read more
  • phildunlap

    It definitely messes with the file, doesn't it? I'll open a git issue for this. Seems like something we'll have to solve elsewhere too, so we'll probably come up with some other solution than omitting the script entirely (otherwise, how would you define it for a new point?)

    posted in User help read more
  • phildunlap

    Hi benaznbe,

    I suspect you were inspired by this thread:

    https://forum.infiniteautomation.com/topic/3503/how-to-chart-with-data-points-in-the-x-axis-instead-of-time

    I'm not sure why it's not working for you. I changed only the XIDs in your code and my chart seemed to render fine. I don't think referencing the datebar's rollup in the ma-point-statistics does what you think (it doesn't do anything, rollups are statistics, and so the statistic directive is doing all rollups over a period. see the documentation inside the Mango UI at /ui/docs/ng-mango/ma-point-statistics)

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    No worries! Just wanted to make sure I didn't need to clean up some part of the documentation. Thanks for showing me the part you were thinking of!

    posted in How-To read more
  • phildunlap

    @mattfox said in Create event detector that applies to all/specific datapoints:

    I'm getting the feeling that this is not currently possible in Mango....

    Well then it's good you bumped it as I missed it somehow! Of course it's possible (probably). You'd have a bunch of options to hack it up. I think compiling a JSON object and placing that into the JSON store will be a useful example. This is a scripting data source:

    var allPoints = DataPointQuery.query("limit(1000000)");
    var delayedUpdates = {};
    var now = Number(CONTEXT.getRuntime());
    for (var k = 0; k < allPoints.length; k+=1) {
      if ( allPoints[k].runtime === null ) //Point or source not enabled
        continue; //We could add it to another status object, instead, or set its key to "disabled" so we can see it
    
      if ( now - allPoints[k].runtime.time > 600000 ) //Ten minutes milliseconds
        delayedUpdates[ allPoints[k].extendedName ] = allPoints[k].runtime.time;
    }
    
    function newJsonDataObject() {
      var jsonDataVO = new com.serotonin.m2m2.vo.json.JsonDataVO();
      jsonDataVO.setPublicData( false );
      jsonDataVO.setReadPermission( "" );
      jsonDataVO.setEditPermission( "" );
      jsonDataVO.setXid( "JSON_delayed_updates" );
      jsonDataVO.setName( "Delayed Updates" );
      return jsonDataVO;
    }
    
    var jsonDataVO = com.serotonin.m2m2.db.dao.JsonDataDao.instance.getByXid( "JSON_delayed_updates" );
    if(jsonDataVO === null)
      jsonDataVO = newJsonDataObject();
    jsonDataVO.setJsonData( delayedUpdates );
    
    //print(JSON.stringify(delayedUpdates));
    com.serotonin.m2m2.db.dao.JsonDataDao.instance.save( jsonDataVO );
    

    Have that on a cron that updates as often as you need to. If loading that point list is cumbersome because your system is massive, that can probably be worked around. The result of this will be a JSON store item with a map of point extended names to last update timestamps iff that update was at least ten minutes ago.

    posted in User help read more
  • phildunlap

    @mattfox said in Can one tell which point has triggered the context update?:

    I believe according to Mango Javascript Documentation under the metadata source, the value you would wish to log could be:CONTEXT_POINTS. You'll want to convert it to JSON before you log it though, that will enable to view all properties available. I've not tried this myself, so just going out on a limb here.

    I couldn't find what you're referencing in the documentation. Can you quote it for me? It shouldn't say that, as the CONTEXT_POINTS array is all the DataPointRT objects that are currently in context (so not disabled points).

    It is not available information readily, but you can find a point which has a value at the same moment as execution and surmise it to have caused it, i.e.

    //This is a for an alphanumeric meta point with multiple points that may update its context.
    // it will output a variable name with a value at the execution time. Note that this may not
    // work in situations like logged events from backdated values, as CONTEXT.getTimestamp() is 
    // the time that triggered execution, where CONTEXT.getRuntime() would be the time it ran. 
    function getContextUpdatedByPoint() {
      for (var pnt in CONTEXT_POINTS) {
        var timestamp = Number(CONTEXT.getTimestamp());
        if (timestamp == this[pnt].time)
          return pnt;
      }
      return null;
    }
    return getContextUpdatedByPoint();
    

    posted in How-To read more
  • phildunlap

    Are these points from a Mango Persistent TCP data source? If so, and you have "Accept point attribute updates" checked but not "Override permissions updates," then the permissions would be cleared if they are empty on the publisher's side while the points are connecting. The solution is to enable "Override permissions updates" on the data source, and then set permissions into those fields that you would like applied to new data points created by the data source. Old data points are then not modified during point attribute updating.

    If not, then can you say more about what is going on and the sequence of events? The only thing i noticed through brief investigation is that if you were to click into the edit field for a permission, press a key and then delete it, the column would still be considered modified and would be applied upon updating the points. I was able to clear the column being considered as modified by selecting a different source / list / folder to edit, then selecting the first set of points again.

    posted in User help read more
  • phildunlap

    I believe this is the feature requested in this issue: https://github.com/infiniteautomation/ma-core-public/issues/661

    Maybe I'll look into what'd be required to implement it (again?)....

    posted in Mango Automation general Discussion read more
  • phildunlap

    Hi jvaughters,

    Here's an example ASCII file reader data source. All that's really required is that the point identifier and the value be capture groups in the value regex, and that the point identifier match the captured group the point identifier index is configured to. You could have a regex like ().* with an empty point identifier (with point identifier index 1) and a value regex of 0 to capture entire lines into a point.

    An example:

    {
       "dataSources":[
          {
             "xid":"DS_bb9fe2d4-0686-4de4-8a2d-d0443f99772c",
             "name":"FileReader",
             "enabled":true,
             "type":"ASCII FILE",
             "alarmLevels":{
                "POINT_READ_PATTERN_MISMATCH_EVENT":"URGENT",
                "POLL_ABORTED":"URGENT",
                "DATA_SOURCE_EXCEPTION":"URGENT",
                "POINT_READ_EXCEPTION":"URGENT"
             },
             "purgeType":"YEARS",
             "filePath":"C:\\IA\\Days\\7-2-18\\file.txt",
             "updatePeriodType":2,
             "updatePeriods":5,
             "editPermission":"",
             "purgeOverride":false,
             "purgePeriod":1
          }
       ],
       "dataPoints":[
          {
             "xid":"DP_5f0311c2-4d02-4798-a5ae-e4083f640ca7",
             "name":"asdf",
             "enabled":true,
             "loggingType":"ALL",
             "intervalLoggingPeriodType":"MINUTES",
             "intervalLoggingType":"AVERAGE",
             "purgeType":"YEARS",
             "pointLocator":{
                "dataType":"NUMERIC",
                "hasTimestamp":false,
                "pointIdentifier":"asdf",
                "pointIdentifierIndex":1,
                "timestampFormat":"",
                "timestampIndex":0,
                "valueIndex":2,
                "valueRegex":"(asdf): (.*)"
             },
             "eventDetectors":[
             ],
             "plotType":"SPLINE",
             "rollup":"NONE",
             "unit":"",
             "templateXid":"Numeric_Default",
             "simplifyType":"NONE",
             "chartColour":"",
             "chartRenderer":{
                "type":"IMAGE",
                "timePeriodType":"DAYS",
                "numberOfPeriods":1
             },
             "dataSourceXid":"DS_bb9fe2d4-0686-4de4-8a2d-d0443f99772c",
             "defaultCacheSize":1,
             "deviceName":"FileReader",
             "discardExtremeValues":false,
             "discardHighLimit":1.7976931348623157E308,
             "discardLowLimit":-1.7976931348623157E308,
             "intervalLoggingPeriod":1,
             "intervalLoggingSampleWindowSize":0,
             "overrideIntervalLoggingSamples":false,
             "preventSetExtremeValues":false,
             "purgeOverride":false,
             "purgePeriod":1,
             "readPermission":"",
             "setExtremeHighLimit":1.7976931348623157E308,
             "setExtremeLowLimit":-1.7976931348623157E308,
             "setPermission":"",
             "tags":{
             },
             "textRenderer":{
                "type":"ANALOG",
                "useUnitAsSuffix":true,
                "unit":"",
                "renderedUnit":"",
                "format":"0.00"
             },
             "tolerance":0.0
          },
          {
             "xid":"DP_7c3f5d37-ba1d-4248-8313-fc5c0f3a6748",
             "name":"bsdf",
             "enabled":true,
             "loggingType":"ALL",
             "intervalLoggingPeriodType":"MINUTES",
             "intervalLoggingType":"AVERAGE",
             "purgeType":"YEARS",
             "pointLocator":{
                "dataType":"NUMERIC",
                "hasTimestamp":false,
                "pointIdentifier":"bsdf",
                "pointIdentifierIndex":1,
                "timestampFormat":"",
                "timestampIndex":0,
                "valueIndex":2,
                "valueRegex":"(bsdf): (.*)"
             },
             "eventDetectors":[
             ],
             "plotType":"SPLINE",
             "rollup":"NONE",
             "unit":"",
             "templateXid":"Numeric_Default",
             "simplifyType":"NONE",
             "chartColour":"",
             "chartRenderer":{
                "type":"IMAGE",
                "timePeriodType":"DAYS",
                "numberOfPeriods":1
             },
             "dataSourceXid":"DS_bb9fe2d4-0686-4de4-8a2d-d0443f99772c",
             "defaultCacheSize":1,
             "deviceName":"FileReader",
             "discardExtremeValues":false,
             "discardHighLimit":1.7976931348623157E308,
             "discardLowLimit":-1.7976931348623157E308,
             "intervalLoggingPeriod":1,
             "intervalLoggingSampleWindowSize":0,
             "overrideIntervalLoggingSamples":false,
             "preventSetExtremeValues":false,
             "purgeOverride":false,
             "purgePeriod":1,
             "readPermission":"",
             "setExtremeHighLimit":1.7976931348623157E308,
             "setExtremeLowLimit":-1.7976931348623157E308,
             "setPermission":"",
             "tags":{
             },
             "textRenderer":{
                "type":"ANALOG",
                "useUnitAsSuffix":true,
                "unit":"",
                "renderedUnit":"",
                "format":"0.00"
             },
             "tolerance":0.0
          }
       ]
    }
    

    imported a file with the contents

    asdf: 1.2
    bsdf: 2.3
    

    posted in User help read more