• 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

    Building publisher list with only points from enabled data sources

    How-To
    2
    3
    1.0k
    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.
    • P
      Phillip Weeks
      last edited by

      IS this possible? I only see the point enabled disabled and it selects the point for inclusion even if the data source is disabled. Is there a way to isolate only points from enabled data sources in the publisher selection list? When dealing with thousands of points that have the same device id across data sources we need a way to remove the disabled data source points from the list even if they have the same device ID.

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by

        The search fields in the header accepts regex, so you could delimit it (deviceName1|deviceName2|...)

        Probably the only way to directly do what you're saying would be through JSON. Given an exported configuration, this Python script would add all enabled data points with enabled data sources to a publisher that doesn't already have them:

        import json
        
        publisherXid = "PUB_Xid_To_Add_To"
        
        configFile = open("/path/to/ds-dp-pub.json")
        config = json.load(configFile)
        configFile.close()
        
        for pub in config["publishers"] :
        	if pub["xid"] == publisherXid :
        		publisher = pub
        		break
        		
        alreadyHas = {}
        for p in publisher["points"] :
        	alreadyHas[p["dataPointId"]] = True
        	
        dataSourceXidMap = {}
        for ds in config["dataSources"] :
        	dataSourceXidMap[ds["xid"]] = ds
        	
        for dp in config["dataPoints"] :
        	if dp["enabled"] and dataSourceXidMap[dp["dataSourceXid"]]["enabled"] and dp["xid"] not in alreadyHas :
        		publisher["points"].append({"dataSourceId": dp["xid"]})
        		
        outputFile = open("/path/to/output.json", "w+")
        outputFile.write(json.dumps(config, indent=4, sort_keys=False, separators=(",",": ")))
        outputFile.close()
        
        1 Reply Last reply Reply Quote 0
        • P
          Phillip Weeks
          last edited by

          Thanks Phil seems like that should work. I will run the script, import the publisher tomorrow and report back on the outcome. Thanks again.

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