• Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular

    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

    What is the best way to do that?

    User help
    2
    6
    2540
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Patriator last edited by

      Got some datapoints for retrieving error codes ( int )
      Wish to offer a view with errors in plain text.

      thought about using customview with a function let's say
      String V(int code , String lang)

      and in viewpoint something like :

      if(value == "0") image = greenflag
      else
      image = redflag
      out.println(V(value.parseInt() , lang));

      but got an error saying that my function does not exist.
      where/how can I declare my function?

      on another hand,
      Is there any way to declare 'transformation scripts' on datapoints in mango. Let's say ScriptA.

      and then custom Datapoint as the result of applying ScriptA on another datapoint.

      something like MetaDatasource or pointslink , but with the same script for all points.
      No copy/Paste

      1 Reply Last reply Reply Quote 0
      • M
        mlohbihler last edited by

        An easy way may be to define your points as multistate, and then create a text renderer that maps the states to text descriptions. Would that work for you?

        Best regards,
        Matthew

        1 Reply Last reply Reply Quote 0
        • P
          Patriator last edited by

          Did not find the clue for using textrenderer.
          Is there any exemple , doc ?

          I guess that if I define a text renderer I'll be able to use it several times and that's exactly the point.

          the other thing is that my points are from a modbus datasource... I'll have to create Meta-Points.

          1 Reply Last reply Reply Quote 0
          • P
            Patriator last edited by

            Well I finally did it via CustomView ...
            Things were easier once I realize that code I can add between view:scriptPoint and </view:scriptPoint> was the code for the
            function(value, time) and should be in javascript.

            So my code looks like that :

            in a js file the declaration of my function.

            in the jsp :

            <h3>Roof n° 1 <img id="scripted" src="images/hourglass.png"/>
            <SPAN id="sperreur" style="color: red"></SPAN>
            
            <view:scriptPoint xid="DP_DP_999973">
              if (value == "0") {
                  $("scripted").src = "graphics/BlinkingLights/light_green.gif";
                  binaryValue = true;
              }
              else {
                  $("scripted").src = "graphics/BlinkingLights/light_red.gif";
            	  $("scripted").title = getErrorString(parseInt(value)) ;
            	  $("sperreur").innerHTML = getErrorString(parseInt(value)) ;
                   binaryValue = false;
              }
            </view:scriptPoint>
            </h3>
            
            1 Reply Last reply Reply Quote 0
            • M
              mlohbihler last edited by

              Text renderers are assigned to points. Editing is found in the page with a "brick" icon that has a pencil on it.

              Anyway, i'm glad that you were able to do this with a custom view. I had a feeling that users were more than willing to do their own scripting.

              Best regards,
              Matthew

              1 Reply Last reply Reply Quote 0
              • First post
                Last post