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

  • Dear Sir,

    I have query on Scripting. The requirement is as follows:

    1.   We have a tag reading KWH reading from energy meter.
      
    2.   Our plant works for 24 Hours 3 shifts. We want shift wise report to be triggered at 6 AM, 14:30PM & 11PM.
      
    3.   Each report should contain Energy consumption for the Shift. So we need a Meta Tag which will subtract Value at 06:00 Hours from value at 14:30 Hours so that energy consumption for Shift-1 is computed & report sent by e-mail. Similarly for B & C shifts.
      
    4.   These reports are to be triggered using CRON pattern (0 0 6 * * ?) / (0 30 14 * 8 ?)
      
    5.   But the script is not giving the correct result (Var X; X=p1.value-p1.ago(HOUR , 8); return X);
      
    6.   Also some scripts like return p1.past(HOUR, 1). Maximum return zero (0) vale, but we have valisd data in the past one hour because p1.past(HOUR, 1). Average returns valid average value.
      
    7.   Please suggest some solution to these issues.
      

    Also can you please mail me the complete syntax for the scripting language supported by Mango?


  • I'm sorry about this there has been a change in the scripting that didn't get changed in the documentation.

    .maximum is now .maximumValue

    Try .maximumValue and .minimumValue in the script and see if that resolves your issues.

    I'll make sure this documentation is changed.

    Joel.


  • Thanks Sir.
    It will be useful if you can mail complete SYNATX list or put it on website also.

    Regards,
    K V Ram


  • Inside the Meta Script Data Source edit page click on the small "?" you will see an explanation there. Here is a excerpt of it:

    JavaScript / ECMAScript

    This data source requires some knowledge of JavaScript, also known as ECMAScript. (The full specification for ECMAScript is available here.) JavaScript is arguably the most popular scripting language in use today, it being the only language available for use in every popular web browser. The result is that, by far the common usage of JavaScript is in web pages. The context within the Meta data source is of course different, there being no "window" or "document" objects, among other more subtle differences. Contextual differences aside, a full and complete implementation of ECMAScript is available within this data source. Specifically, the Rhino implementation is used https://developer.mozilla.org/en-US/docs/Rhino.