I am trying to do a label binding to recreate the functionality of the marquee mode of the vision alarm status in Perspective 8.1.25
My issue is that what is being displayed is inconsistent with the Dataset (i.e. the code will pass in one as the index but the label will show the value for 0). In many cases values are skipped over. Is there anything that I am failing to take into account that I can mitigate through python?
python transform is attached to a query binding that just runs the query GETDATE() every 5 seconds and the code for the transform is attached below
def transform(self, value, quality, timestamp): from time import sleep results = system.alarm.queryStatus(state="2",priority="3",includeShelved=False) resultDS = results.getDataset() curAlert = self.custom.curAlert self.custom.totalAlerts = resultDS.getRowCount() sleep(0.3) if self.custom.totalAlerts ==0: self.custom.curAlert = 0 return "No current active alarms" self.props.style.backgroundColor ="#FFFFFF" self.props.textStyle.color ="#000000" if curAlert < self.custom.totalAlerts-1: self.custom.curAlert +=1 else: self.custom.curAlert = 0 sleep(0.3) outString = resultDS.getValueAt(self.custom.curAlert,2) self.props.style.backgroundColor ="#000000" self.props.textStyle.color ="#FFFFFF" if self.custom.curAlert %2 == 1: sleep(3) return str(outString)
Thanks for your help in advance.