Purge point data on button click
-
Hi.
I need to purge the data collected by a data point on the click of a button. I have been able to set the value of a data point by taking input from the user in the graphical view. My next step is to purge all the data, completely, without taking any duration as an input from the user.
I think this would be possible by writing a script for a button in the graphical view. Or may be a server side script. I'm not really sure about this.
Any suggestions would be appreciated.
-
Hello!
It looks to me like you might be looking for something like the function call in DataPointEditDwr.java @ line 131. That file can be found https://github.com/infiniteautomation/ma-core-public/blob/21b40809b07fac6c74aa3905a6124e880ea2073b/Core/src/com/serotonin/m2m2/web/dwr/DataPointEditDwr.java for the source code.
The call that may help is,
Common.runtimeManager.purgeDataPointValues(point.getId());
Hope that helps! The alternative is probably to call DataPointEditDwr, and purge it through the tools already available. I have not tested these, yet, though, so let us know if it worked and how!