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.

  • Single CRON vs Many CRON

    2
    0 Votes
    2 Posts
    2k Views
    JoelHaggarJ
    That's an interesting idea. I've never tried it but seems like you could use a single point to trigger the update on a group of other points.
  • Script to enter last read when the read is zero, or NAN

    3
    0 Votes
    3 Posts
    3k Views
    C
    @hussam I am using a metadatasource to grab the point from an original BACNET in order to make a clean timestamp at 5 minute intervals. It is on this metadatasource point that I am using this script..
  • 0 Votes
    3 Posts
    2k Views
    hussamH
    a typical error is one datapoint which in context var list be disabled, or be delete in other place,this datapoint var will occur ReferenceError: "p1" is not defined, and the next script will not execute. I have tryed to use typeof p1 !=undefined or p1!=null to check first , but it seem like don't work.
  • Meta point to return max value of multiple points over period

    6
    0 Votes
    6 Posts
    4k Views
    jeremyhJ
    Using 'prev' instead of 'past' didn't fix the spikes issue. My guess would be that the spikes occur when a point in the array has not changed within that 5 minute window. However, I'm not sure why that is, as it should result in no value for that datapoint, which shouldn't affect the maximum. Instead it behaves like the point has a value of about 27.1.
  • Saving previous scripting data source data

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    8 Views
    No one has replied
  • Mango Scripting Data Source and Data Points

    7
    0 Votes
    7 Posts
    5k Views
    L
    @JoelHaggar Thanks Joel! This worked. However is there any way to make the time period dynamic. Ie. Instead of Month a user within DGLux would be able to select past 'Month, 2months, 3months or year. I want to try to avoid creating seperate script and seperate variables for each time period. I also was thinking if this is possible using a historical query table in DGLux? If I set the interval to 0 (when the parameter changes) and set the period range (dynamic) and I sum the value column I believe I will end up with the count that I want. Am I able to determine the sum of a column using a formula column and script? I have looked into using the rollup widget but have not been able to get anywhere with it. Thanks,
  • How to Change the value of a data point

    10
    0 Votes
    10 Posts
    7k Views
    JoelHaggarJ
    There are lots of ways to do this. First make sure in the data point settings you have made the modbus point settable. Next on the graphic views add the point with one of the widgets. You can use a simple point to start with. Check both the Settable Override option and the display controls option. Now when you view the graphic view and hover the mouse over the item you will see a little wrench popup to allow you to set the points value. You can also use a server side script to do all sorts of things. Here are some example scripts that would be helpful: http://infiniteautomation.com/wiki/doku.php?id=graphics:mango_graphic_views:server_side_script_examples
  • lastValue not available in graphical view Server Side Script

    2
    0 Votes
    2 Posts
    2k Views
    JoelHaggarJ
    No, server side scrips are a totally different system. They actually run in the browser. Calling them server side scripts is missleading.
  • 0 Votes
    5 Posts
    3k Views
    hussamH
    And i have tested, it is base on cron time,so the cron need after the 0 clock.
  • Calling a user-defined function from different meta data point scripts

    6
    0 Votes
    6 Posts
    3k Views
    P
    I could only find "Global Scripts" under the "Meta Data Source" and "Scripting Data Source" wiki headings. Consequently, it is unclear which of the "Scripting Data Source" recommendations also apply to global scripts (and also why I did not think to look at the icon bar for the Global Scripts). Specifically, the Scripting Data Source states: Note how the typeof function is used to determine if constants need to be defined. This is an effective way of initializing the script context upon startup of the data source. if (typeof(rho) == "undefined") { rho = 28; sigma = 10; beta = 8/3; dt = 0.01; } I have defined functions containing equations in Global Scripts. They contain implicit constant definitions. For example: return (2.43941E-7*W3 -0.5433*W2 +0.06*W+2.0) The function seems to be working fine, but I'm concerned about the "effective way" cited on the Scripting Data Source page. Should I pull those constants out of the equation and declare them within a typeof structure? What are the implications of not doing that? Performance? Memory? Memory leaks? Why is this recommended for a Scripting Data Source? Speed? Thanks.
  • Running JSON from command line?

    2
    0 Votes
    2 Posts
    2k Views
    sjobbeS
    I have a PHP script that creates JSON for adding data points. Could i run the JSON from command line (in linux)? I could then trigger it from the PHP script. Currenlty PHP creates the JSON file to the templates folder and I then need to run it from "Templates" by selecting it from the drop down list. Not very convenient...
  • Meta data script for KWH

    4
    0 Votes
    4 Posts
    3k Views
    hussamH
    this actually one problem i also meet? what 's your solve now? Here is some suggest: you script below is not right, because .ago will get the least value before 15 miniute,but not get the value at before 15 miniute. if (p78.ago(MINUTE,15) != 0) return p78.value - p78.ago(MINUTE,15) ; else return 0 ; the best way is official provide on function to get the exactly time values. the second way you can try like this, if ((p78.ago(MINUTE,15) -p78.ago((MINUTE,16))==0),this means you point is interruption
  • [SOLVED] correct point var name for scripts...

    11
    0 Votes
    11 Posts
    5k Views
    danD
    SOLVED!! I mucked around with this for a few hours and found if I changed all the labelled set points from say 'AUTO' and 'MANUAL' to just true and false it now works, brilliantly!! Thanks Joel and team for all your assistance! Although I do still notice nothing in the trace log for the script other than the Data source started line. Cheers Dan
  • Variable's value persistence between script executions

    5
    0 Votes
    5 Posts
    3k Views
    JoelHaggarJ
    Yes, your example is better but the current value of a data point is stored in cache so does not require a database read.
  • Switch Solenoids using pulse outputs and polarity changes...

    10
    0 Votes
    10 Posts
    5k Views
    phildunlapP
    Hi Dan, Currently the only supported scripting engine is JavaScript. On top of that there are hooks for the Mango functions to get and manipulate point values. This documentation can be found in the meta point properties help dialogue, or here: http://wiki.infiniteautomation.com/doku.php?id=meta_data_properties starting at the 'Scripts' header.
  • POST Method (HTTP sender publisher) using Graphic View

    2
    0 Votes
    2 Posts
    2k Views
    V
    Hi, How could I create two input boxes in the Graphic view and process a POST using a HTTP sender publisher with the current two values from the Graphic View?. Thanks in advance.
  • Refresh modbus with button

    5
    0 Votes
    5 Posts
    4k Views
    phildunlapP
    I tried to look into your question briefly to see if there was a function you could call, something like mango.view.initPointDetails() or DataPointDetailsDwr.forcePointRead(dpid, callback func) from a server-side script, but I haven't met obvious success trying that. I doubt those functions prompt the modbus to poll, but I'm not 100% certain. It's something to experiment with, if you feel so inclined. My intuition is aligned with Joel's, though: this is something that would take code customization to achieve.
  • Purge point data on button click

    3
    0 Votes
    3 Posts
    3k Views
    phildunlapP
    Hello! It looks to me like you might be looking for something like the function call in DataPointEditDwr.java @ line 131. That file can be found https://github.com/infiniteautomation/ma-core-public/blob/21b40809b07fac6c74aa3905a6124e880ea2073b/Core/src/com/serotonin/m2m2/web/dwr/DataPointEditDwr.java for the source code. The call that may help is, Common.runtimeManager.purgeDataPointValues(point.getId()); Hope that helps! The alternative is probably to call DataPointEditDwr, and purge it through the tools already available. I have not tested these, yet, though, so let us know if it worked and how!
  • Toggle a Modbus Relay IO control every two seconds

    4
    0 Votes
    4 Posts
    3k Views
    M
    Matthew, perfect.... you rock!!! Regards, Narayana Swamy