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

  • Hi, all
    I have a story to help. Scripting control to publishers. Want to write control scripts for publishers By enabling / disable the publisher
    such as
    1.Scripting control to Data sources.

    var d = 'DP_835f4865-3de8-47cc-9c7b-3121b7a65bf9'; //Change to your data source's XID
    RuntimeManager.enableDataSource(d);
    

    2.Scripting control to Data point.

    var d = 'DP_835f4865-3de8-47cc-9c7b-3121b7a65bf9'; //Change to your data source's XID
    RuntimeManager.enableDataPoint(d);
    

    I try to write like this and it is not available.

    var d = 'DP_835f4865-3de8-47cc-9c7b-3121b7a65bf9'; //Change to your data source's XID
    RuntimeManager.enablePublishers(d);
    
    error RuntimeManager.enablePublishers is not a function
    

  • Hi JoHn-Beer,

    It does seem like those functions should exist for completeness. Currently there would be two ways to do this,

    1. Use the JsonEmport tool. You could export the publishers JSON, find the publisher you wished to toggle, change the 'enabled' property appropriately and reimport.
    2. Go through the actual runtime manager, like
    function enablePublisher(xid, enabled) {
      var publisher = com.serotonin.m2m2.db.dao.PublisherDao.getByXid(xid);
      publisher.enabled = enabled;
      com.serotonin.m2m2.Common.runtimeManager.savePublisher(publisher);
    }
    

    And then call it as needed. I'll create a git issue about putting such a function into the script environments' RuntimeManager utility.