How to Change the value of a data point
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
This can easily be done using a DGLux page which we have many tutorial on in this forum.
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;
Thanks for the code
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.
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.
thanks for that I'll try that.
yep that worked!! thanks for that.
Iam facing a problem,
how to write a value through a graphical view in modbus mango
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