• 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

    Changing datasource of datapoint

    User help
    3
    4
    2.8k
    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.
    • J
      JTFANA
      last edited by

      I have two modbus serial data sources on my mangoes (internal and external usb serial adapter) and I changed the architecture of my modbus serial network a bit and would like to change the data source of a bunch of datapoints from one modbus serial datasource to another.

      I have tried exporting the points i would like to move and find/replace the dataSourceXid and although the import tool says the points were saved the data source did not change.

      also, it doesn't seem there is a way to change the datasource in the web interface, as there is no data source parameter for data points.

      Is there a way to do this without loosing the points history/pointlinks/etc.?

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

        Edit: This post was incorrect

        1 Reply Last reply Reply Quote 0
        • JoelHaggarJ
          JoelHaggar @JTFANA
          last edited by

          @JTFANA You can do this in the database. You would need to run some SQL Statements in the SQL Console. You'll want to restart Mango after you do this to get the chances loaded in. I would also recommend making a backup of your database first. You can do this on the system setting page under the H2 Database Settings section

          Go to the SQL Console and run

          select * from datasources
          

          upload-74467577-ac47-4a40-932c-e8ac3ac75899

          Find the ID of the source Data Source and the ID of the destination Data Source. Make sure they are both the same Data Source type.

          Now you can run:

          select * from datapoints where DataSourceID = 1
          

          Where the DataSourceID is the ID of your source Data Source. Make sure these are the Data Points you want to move.

          Now you can run this update statement to move the data points.

          update datapoints set DataSourceID = (Destination Data Source ID) where DataSourceID = (source data source ID);
          

          It would look like this for example:

          update datapoints set DataSourceID = 2 where DataSourceID = 1;
          

          Now go to the modules page and click the Restart this instance button to reboot Mango.

          If you have problems with this you can easily restore your database from the backup you made so be sure to make that backup.

          J 1 Reply Last reply Reply Quote 0
          • J
            JTFANA @JoelHaggar
            last edited by

            @phildunlap I first tried the JSON Import/Export method as that is what I am familiar with using to make similar changes, but for this it just wasn't sticking.

            @JoelHaggar Thanks for the step by step instructions, it was extremely helpful as I don't have much experience with SQL queries. It worked like a charm, just had to add a device name filter to the update query as I didn't want to move all datapoints.

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