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

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Trying to display more than one return meta-point value using javascript

  • Hi All,

    I am trying to create a Javascript that will get values from meta-points and compare them to max value. I want the script to be able to iterate the data and display all the values that are greater than the max value not just one.

    So far I have only been able to create an if/else-if statements to find the value. The issue with this is it only will display the first occurrence of the value being larger than the max value. I currently have this set up as a Numeric data-type and am setting up an event handler with a max limit detector.

    I am unsure if this is possible to loop the values and compare it to the max or create a function which will compare the values? Also if I have to change the data type of the type of event detector I use?

    What I have done so far is:

    var max = 28;

    if (t1.value > max){
    return t1.value
    else if (t2.value > max) {
    return t2.value
    else if (t3.value > max){
    return t3.value
    else if (t4.value > max) {
    return t4.value
    else if (t5.value > max){
    return t5.value
    else if (t6.value > max){
    return t6.value
    else if (t7.value > max) {
    return t7.value
    else if (t8.value > max){
    return t8.value

    Please if anyone has any insight or recommendations on how this could be done it would be greatly appreciated.


  • You should read the help and use the datapoint query utilityto make an rql query under the mango javascript help.
    You can then pull them all when the script runs and loop through them to see what is higher.

    That's all I can suggest for now, if I have more time I'll look into it further later.


  • Hi hs.egonzalez, welcome to the forum!

    Fox's suggestion is good if you don't want to deal with adding points into the context of the meta point manually, but it sounds like you've probably already done that.

    It sounded to me like your question was more in encoding the return value to contain multiple values. You cannot have two point values at the same millisecond using the NoSQL database (which I know you are). So, it sounds to me like the only solution is going to be to encode the information you're looking for into an alphanumeric value, like

    var max = 28;
    var result = "";
    var first = true;
    for( var variableName in CONTEXT_POINTS ) {
      if( this[variableName].value > max ) {
          result += ", ";
          first = false;
        result += this[variableName].value;
    return result;

  • Not sure if it will be an issue here but in the past when I have used a loop like this :
    for( var variableName in CONTEXT_POINTS ) {}
    CONTEXT_POINTS contains the meta-point variable in it, called myVar by default. So Phillips code could possibly add the meta-points own value to the result.

  • Thanks for pointing that out Craig! We could fix the if condition for this for the default variable name with,

    if( this[variableName].value > max && variableName !== "my" ) {