Scripting for META Tags
-
Dear Sir,
I have query on Scripting. The requirement is as follows:
-
We have a tag reading KWH reading from energy meter.
-
Our plant works for 24 Hours 3 shifts. We want shift wise report to be triggered at 6 AM, 14:30PM & 11PM.
-
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.
-
These reports are to be triggered using CRON pattern (0 0 6 * * ?) / (0 30 14 * 8 ?)
-
But the script is not giving the correct result (Var X; X=p1.value-p1.ago(HOUR , 8); return X);
-
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.
-
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.