Hi everyone
Is it possible, we can use writeDataPoint method in server side scripting ?
we have a section for questions in English.
In this post already been discussed this http://www.scadabr.com.br/?q=node/152
At the link below are examples of codes to use this component.
http://mango.serotoninsoftware.com/forum/posts/list/598.page # 2859
Examples in: dropdown, checkbox, etc..
Hug
Fábio
Thank's for the replay.
But In my case no any image or textbox. My problem is just change virtual data point value true to false.
I hope you understand my problem.
Regards
Ok, but you really need to use server side script for this? There is a component called writing button, add it and choose the virtual datapoint. This will create a button. When you click it will change the value (true or false).
If you want to click on an image (a lamp) and image represent the datapoint_virtual is connected, use the example below:
Lamp image, clicking on it is setting/resetting a bit in variable
- var s = "";
- var mask =1024; //1024 is bit 10, 8=bit 3
- var arvo = "";
-
- if (value & mask)
- {
- arvo = value - mask;
- arvo = arvo +"";
- s += "<img style='cursor:pointer;' src='graphics/LightBulb/light_on.gif' onclick='mango.view.setPoint("+ point.id +", \""+ pointComponent.id +"\","+ arvo+");return false;'/>";
- }
- else
- {
- arvo = value + mask;
- arvo = arvo +"";
- s += "<img style='cursor:pointer;' src='graphics/LightBulb/light_off.gif' onclick='mango.view.setPoint("+ point.id +", \""+ pointComponent.id +"\","+ arvo+");return true;'/>";
- }
- return s;
-
You will need to adjust the command indicating the image path.
hug
Fabio (kkkk by google translate)
first of sorry because i was not clearly give idea about my requirement. I have explain properly.
I was trying to delete datapoint history. diegoferreira was already help on them.He say that use this code.
var dpDao = new com.serotonin.mango.db.dao.DataPointDao();
var dpVo = dpDao.getDataPoint('<you dp xid>');
dpDao.deletePointHistory(dpVo.getId());
write this code in server side scripting. And this work successfully. But i was trying to add confirmation message before delete because of above code datapoint history is directly deleted and use may be create a mistake so for protection i am trying to generate confirmation popup message.
Infact , i was done this using html coding in server side scripting but problem is whenever refresh or login every time generate confirmation popup window so i was apply another trick. I was add one virtual datapoint and add one button(script) component. Using this component i was changed virtual datapoint value and whenever value is true execute server side script.
After delete datapoint value i was required to change virtual datapoint value to false so again datapoint value not deleted.
I hope using this message picture will be cleared in your mind. one more thing i am electronics engineers so may be i am not propely understand coding so please help me.
Regards