• Recent
    • Tags
    • Popular
    • Register
    • Login

    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 Mango 5 Documentation Website

    How to Change the value of a data point

    Scripting general Discussion
    4
    10
    5.6k
    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.
    • E
      eriasu
      last edited by

      Hello first sorry for my bad English is not my native language but i can understand very well.
      I am running a SCADA project and one of the requirements from the clients is that from a graphical view change the state of a point like from on to Off and i want to do this using scripting but i dont now very well how to start with this if you cant send my a link to some examples i will be very grateful

      1 Reply Last reply Reply Quote 0
      • JoelHaggarJ
        JoelHaggar
        last edited by

        This can easily be done using a DGLux page which we have many tutorial on in this forum.
        http://forum.infiniteautomation.com/forum/posts/list/1310.page

        Here are some example server side scripts that should do what you need on the Mango Graphic Views:

        //Server Side Script
        //Toggle on image click

        var s = "";
        if (!value)
            s += "<img style='cursor:pointer;' src='/modules/sstGraphics/web/graphics/Drinks/drink_empty.png' onclick='mango.view.setPoint("+ point.id +", \""+ pointComponent.id +"\", \"true\");return true;'/>";
        else if (value)
            s += "<img style='cursor:pointer;' src='/modules/sstGraphics/web/graphics/Drinks/drink.png' onclick='mango.view.setPoint("+ point.id +", \""+ pointComponent.id +"\", \"false\");return false;'/>";
        return s;
        
        1 Reply Last reply Reply Quote 1
        • E
          eriasu
          last edited by

          Thanks for the code

          1 Reply Last reply Reply Quote 0
          • danD
            dan
            last edited by

            Gidday Joel, I tried the above script in an attempt to have a solenoid valve that is clickable and changes colour when it changes state.
            Every time I hit save after I've pasted in the script the point disappears off the graphics screen, really strange. Does this indicate an error in the script?
            Nothing comes up in the logs.

            Cheers
            Dan

            1 Reply Last reply Reply Quote 0
            • JoelHaggarJ
              JoelHaggar
              last edited by

              I was not able to reproduce the issue. Did you modify the image URL? I'm thinking that might be the issue is that it's not finding the image.

              Note that if you are using Mango Automation the image URL will be like this: /modules/sstGraphics/web/graphics/Drinks/drink_empty.png

              Hopefully this will help.

              1 Reply Last reply Reply Quote 0
              • danD
                dan
                last edited by

                thanks for that I'll try that.

                Cheers

                1 Reply Last reply Reply Quote 0
                • danD
                  dan
                  last edited by

                  yep that worked!! thanks for that.

                  1 Reply Last reply Reply Quote 0
                  • S
                    sarrah
                    last edited by

                    Iam facing a problem,
                    how to write a value through a graphical view in modbus mango

                    1 Reply Last reply Reply Quote 0
                    • JoelHaggarJ
                      JoelHaggar
                      last edited by

                      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

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