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

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Changing the name of a data point using a script

  • Heya,

    I am trying to create a function that will update the name of a data point. I have successfully used a similar function to create a point but this one does not appear to work:

    function updateDataPointName(deviceName, pointName, newName) {
        var dataPoints = JSON.parse(JsonEmport.getConfiguration("dataPoints")).dataPoints;
        function findByName(list, deviceName, pointName) {
            for (var k = 0; k < list.length; k+=1)
                if (list[k].deviceName === deviceName && list[k].name === pointName)
                    return list[k];
            return undefined;
        var point = findByName(dataPoints, deviceName, pointName);
        if (typeof point === 'undefined') {
  'Could not find point with name '+deviceName+' - '+pointName);
        else {
   = newName;
            JsonEmport.doImport(JSON.stringify({"dataPoints": [point]}));

    The logs show that the point name is being changed but when I check the point in the data source, the name was not changed. I don't see any errors in the ma.log either.

    Any suggestions? Can you change the data point name this way?


  • @iperry

    The JsonEmport utility provides methods to pass JSON or get JSON as one would through an import/export page. "A script cannot save itself through the emport utility". If it tried, that item in the JSON will be ignored. This utility is accessible through the context key "JsonEmport" and has the following functions:

    I think this point in quotes relates to all methods inside the JsonEmport for a script, not just a script trying to update itself.
    I'd recommend using the API to update the point data info.
    To make things easier I wrote my own wrapper methods for the HTTP utility and saved it in the global scripts. Means I can pass my own callback functions to do whatever I like after each execution of an HTTP method.

    EDIT: might be wrong re the import script. You've either found a bug or something is missing in your format. I'd recommend printing out your config to import and try manually importing it to see if you get any other errors...


  • Hi @MattFox

    Good suggestion to attempt to manually import the changes to the data point. When I did that, I got the "errors":

    Data point 'DP_xyz': intervalLoggingPeriod --> Must be greater than zero
    Data point 'DP_xyz': purgePeriod --> Must be greater than zero
    Data point 'DP_xyz': intervalLoggingSampleWindowSize --> Must be greater than zero
    Import complete

    It's odd that the import tool seems to imply that the import was successful. /shrug When I examine the fields, those values are set to zero, yet the data point was originally saved. Hmmm

    The next test was I exported the point from the ui instead and imported. Same "errors".

    Next, I just tried to save the data point in the ui and this time got an error! Hmmm

    What I discovered is that the copied data point I was using for testing didn't actually save properly. It looked like it had. The issue was that the copy process didn't copy the custom template used in the original. When I re-copied the point, the template wasn't applied and caused an error when saving. After selecting the template, the save was "successful".

    Then my function worked just fine to update the name. A bit of an adventure figuring that one out heh.


  • Nicely done man!
    At least you know why now. Glad I could be a sounding board!