Publisher Queries?
-
Hi again.
Is there an option similar to DataPointQuery.query but for use in publishers? I want to create a script that activates all publishers at the same time.Thanks!!
-
@aosc98 there is not a utility like that. However it would be possible to do the same type of RQL query on the publisher's table but it would require understanding the java backing code and how to access it from the script environment. I don't have the resources to currently supply you with a fully working example but if you are proficient in Java and Javascript this shouldn't be too much of a stretch to look into our public code on GitHub and figure it out. This might jumpstart some thoughts out there, and could work in Mango 3.7.x:
//Get a reference to Common to be able to 'find' a Spring Bean var Common = Java.type('com.serotonin.m2m2.Common'); //Find the publisher dao var dao = Common.getBean(Java.type('com.serotonin.m2m2.db.dao.PublisherDao').class); var RQLUtils = Java.type('com.infiniteautomation.mango.util.RQLUtils'); //Parse RQL to ASTNode var astNode = RQLUtils.parseRQLtoAST('eq(name,Testing Publisher)'); //Query using RQL dao.rqlQuery(astNode, function(dp, row) { console.log(dp.name); });