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

Server-Side Script to output a table with latest n values of a datapoint


  • Hello all,
    I'm trying to create a server-side script to retrieve latest n values for selected datapoint and present it in tabular shape.
    Is there a way to retrieve archived values from a server-side script?

    Thank you for your help.


  • Hello,

    I solved this. But, I modified ScadaBR 0.9 (fork Mango). When you able to modify source code of Mango, I can send my code. It is a few classes.

    Ondrej


  • Thank you Ondrej!
    I thought there is a server-side script to do dirty work but I haven't find anything.. :)
    I'll keep your contact in case I'll decide to rebuild mango too..
    Thank you for now


  • You can see some demo on http://kraken.alarex.net:8080/scada_orlik/public_view.htm?viewId=14

    This is combination serverscript, javascript and Flash.

    Code, which is used in View. "dataPoint.getLatestPointValues(10)" is own added method to ScadaBR.

    
    var data_series =  dataPoint.getLatestPointValues(10);
    var pole = "[";
    for (i=0;i<data_series.size();i++) {
         pole+=""+data_series.get(i).getDoubleValue();
         if (i!=data_series.size()-1) pole+=",";
    }
    pole+="]";
    
    s = "<script>try {document.getElementById(\"AXLED\")._ax_setChartValues("+pole+");} catch (e){};</script>";
    return s;
    
    

    On http://kraken.alarex.net:8080/scada_orlik/public_view.htm?viewId=15
    is some test of JavaScript chart.

    ServerScript is non-standard, but can be strong in Mango, when some change be provided. I like it and I think, that this is best on Mango.

    Ondrej


  • Great job!

    You use your mod in order to retrieve datas for the little graph on the right, don't you?


  • Yes, I can use data for graph or table of values. I have method in Server - javascript (View) for last X values or values between time interval.
    Similar method I have in javascript (dataPoint). Now I can get last of values and calculate weightedd average, moving average for example.

    Ondrej