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

Sum of Data Points in a Data Source


  • Hey all,

    I'm sure there's a simple solution to this, but my head is spinning trying to figure out everything going on with this software. Haven't had to mess with HTML/Javascript in about 15 years.

    I just want to sum all the points on a data source. I have a modbus meter monitoring amperage on 42 circuits. Amps are the only points on the device. It can either be something in the page itself or an actual data point that I'm referencing.


  • @Trevor I would suggest setting up a meta data point on a meta data source that looks some thing like this -
    0_1572537128859_04809aae-aaf0-4bcd-8cc4-8f8bec2b5ba4-image.png

    You need to give every point a unique key but it doesn't matter what it is, also set them all to "Updates context".


  • Script for convenience

    var total = 0;
    for (var key in CONTEXT_POINTS) {
        if (key != 'my') {
            total += this[key].value;
        }
    }
    
    return total;
    

  • @jared-wiltshire

    Hey Jared,

    Thanks! This is perfect.

    Sorry to bother you with what are pretty basic questions, but I have a couple more.

    Is there a way to import/export Menu Items and Custom Pages as JSON files? Or is there a way to find them in the file structure so I can build them outside of the app? This is going to end up being a fairly sizeable installation and I'm hoping to avoid adding/sorting/copying them by hand one at a time.


  • @trevor said in Sum of Data Points in a Data Source:

    Is there a way to import/export Menu Items and Custom Pages as JSON files? Or is there a way to find them in the file structure so I can build them outside of the app? This is going to end up being a fairly sizeable installation and I'm hoping to avoid adding/sorting/copying them by hand one at a time.

    The pages and menu items are stored in the JSON store. So if you go to the Configuration Import/Export page you can export the JSON store items there.

    Another option is to add a user module that registers menu items and loads the pages from the file store.